Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177836166
D60776.1795395568.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D60776.1795395568.diff
View Options
diff --git a/secure/lib/libcrypt/crypt-des.c b/secure/lib/libcrypt/crypt-des.c
--- a/secure/lib/libcrypt/crypt-des.c
+++ b/secure/lib/libcrypt/crypt-des.c
@@ -614,6 +614,10 @@
* setting - underscore, 4 bytes of count, 4 bytes of salt
* key - unlimited characters
*/
+
+ if (strlen(setting) != 9)
+ return (-1);
+
for (i = 1, count = 0L; i < 5; i++)
count |= ascii_to_bin(setting[i]) << ((i - 1) * 6);
@@ -643,19 +647,15 @@
* setting - 2 bytes of salt
* key - up to 8 characters
*/
+ if (strlen(setting) != 2)
+ return (-1);
+
count = 25;
salt = (ascii_to_bin(setting[1]) << 6)
| ascii_to_bin(setting[0]);
- *buffer++ = setting[0];
- /*
- * If the encrypted password that the salt was extracted from
- * is only 1 character long, the salt will be corrupted. We
- * need to ensure that the output string doesn't have an extra
- * NUL in it!
- */
- *buffer++ = setting[1] ? setting[1] : setting[0];
+ buffer = stpncpy(buffer, setting, 2);
}
setup_salt(salt);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 12:59 AM (12 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40955227
Default Alt Text
D60776.1795395568.diff (1 KB)
Attached To
Mode
D60776: crypt_des: fail if salt/session is too short
Attached
Detach File
Event Timeline