Add length check for fixed-size string

This commit is contained in:
David Maciejak 2019-06-02 11:32:21 +08:00 committed by GitHub
parent b589d658bd
commit f2d2cd338e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,7 +111,7 @@ void password_to_key_md5(u_char * password, /* IN */
if (mylen < 8) {
memset(bpass, 0, sizeof(bpass));
strcpy(bpass, password);
strncpy(bpass, password, sizeof(bpass) - 1);
while (mylen < 8) {
strcat(bpass, password);
mylen += passwordlen;