string null-termination fix

strncpy does not generate null-terminated string, fixed by memcpy.
This commit is contained in:
Peter Popovec 2019-08-30 09:01:39 +02:00 committed by Frank Morgner
parent f621305140
commit 5b8095ca2c
1 changed files with 1 additions and 1 deletions

View File

@ -1023,7 +1023,7 @@ static int read_ssh_key(void)
buf[1] = 0;
buf[2] = 0;
len = snprintf((char *) buf+4, 20, "ecdsa-sha2-nistp%d", n);
strncpy(alg, (char *) buf+4, 19);
memcpy(alg, buf+4, 20);
buf[3] = len;
len += 4;