Add length check for fixed-size string

To prevent possible overflow.
This commit is contained in:
David Maciejak 2019-06-02 11:11:30 +08:00 committed by GitHub
commit 99205f0410
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,7 +48,7 @@ int32_t start_rdp(char *ip, int32_t port, unsigned char options, char *miscptr,
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
strcpy(server, hydra_address2string(ip));
strncpy(server, hydra_address2string(ip), sizeof(server) - 1);
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
strncpy(domain, miscptr, sizeof(domain) - 1);