X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fcrypt_des.c;h=d7b2b15af40be3bdc71b5554f154e11615b35758;hb=594318fd3d13c7dda1ea87a76934e052ac74301f;hp=4dc6b4b5dbe70e39a955f2c44921d13a049c963c;hpb=cdf51506ce895286011ff0abe5434557845108ee;p=musl diff --git a/src/misc/crypt_des.c b/src/misc/crypt_des.c index 4dc6b4b5..d7b2b15a 100644 --- a/src/misc/crypt_des.c +++ b/src/misc/crypt_des.c @@ -911,7 +911,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char return NULL; count |= value << (i - 1) * 6; } - if (!count) + if (!count || count > 262143) return NULL; for (i = 5, salt = 0; i < 9; i++) { @@ -1014,11 +1014,8 @@ char *__crypt_des(const char *key, const char *setting, char *output) * likely that any alignment related issues would be detected. */ p = _crypt_extended_r_uut(test_key, test_setting, test_buf); - if (p && !strcmp(p, test_hash)) + if (p && !strcmp(p, test_hash) && retval) return retval; - /* - * Should not happen. - */ - return NULL; + return (setting[0]=='*') ? "x" : "*"; }