← Commit list

5e9b95ff4

Denys Vlasenko
Denys Vlasenko
2025-07-07
SOURCE BUG Duration: 83s

Subject

cryptpw: -m sha512crypt must also be accepted

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): libbb/yescrypt eklenirken (2025-07-06 - 2025-07-07 arasi) once unutulan kaynak dosyalari (pw_encrypt_yes.c, hash_sha256_block.c, pw_ascii64.c), ardindan 64-bit'te derlenmeyen bir 'buflen' degiskeni (alg-yescrypt-kdf.c) vardi - busybox'in kendi kodundaki gercek hatalar (e5d3a8763 ile duzeltildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/pw_encrypt.c+1 -1
@@ -30,7 +30,7 @@ char* FAST_FUNC crypt_make_pw_salt(char salt[MAX_PW_SALT_LEN], const char *algo)
*salt_ptr++ = '$';
#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA
if ((algo[0]|0x20) == 's') { /* sha */
- salt[1] = '5' + (strcasecmp(algo, "sha512") == 0);
+ salt[1] = '5' + (strncasecmp(algo, "sha512", 6) == 0);
len = 16 / 2;
}
#endif
testsuite/cryptpw.tests+4 -0
@@ -49,6 +49,10 @@ testing 'cryptpw sha512' \
'cryptpw -m sha512 QWErty 123456789012345678901234567890' \
'$6$1234567890123456$KB7QqxFyqmJSWyQYcCuGeFukgz1bPQoipWZf7.9L7z3k8UNTXa6UikbKcUGDc2ANn7DOGmDaroxDgpK16w/RE0\n' \
'' ''
+testing 'cryptpw sha512crypt' \
+ 'cryptpw -m sha512crypt QWErty 123456789012345678901234567890' \
+ '$6$1234567890123456$KB7QqxFyqmJSWyQYcCuGeFukgz1bPQoipWZf7.9L7z3k8UNTXa6UikbKcUGDc2ANn7DOGmDaroxDgpK16w/RE0\n' \
+ '' ''
testing 'cryptpw sha512 rounds=99999' \
'cryptpw -m sha512 QWErty rounds=99999\$123456789012345678901234567890' \
'$6$rounds=99999$1234567890123456$BfF6gD6ZjUmwawH5QaAglYAxtU./yvsz0fcQ464l49aMI2DZW3j5ri28CrxK7riPWNpLuUpfaIdY751SBYKUH.\n' \