Add length check for fixed-size string

This commit is contained in:
David Maciejak 2019-06-02 11:18:27 +08:00 committed by GitHub
commit f1e0df4080
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1212,7 +1212,7 @@ int32_t start_smb(int32_t s, char *ip, int32_t port, unsigned char options, char
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
strcpy(ipaddr_str, hydra_address2string(ip));
strncpy(ipaddr_str, hydra_address2string(ip), sizeof(ipaddr_str) - 1);
SMBSessionRet = SMBSessionSetup(s, login, pass, miscptr);
if (SMBSessionRet == -1)