1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

misc: Use strncpy instead of strcat.

This is just hardening the code.

Found by Coverity.
This commit is contained in:
Andreas Schneider
2012-10-08 21:42:17 +02:00
parent 0a4ea19982
commit a660177a6e

View File

@@ -777,7 +777,7 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
return NULL;
}
l = strlen(buf);
strcat(buf + l, x);
strncpy(buf + l, x, sizeof(buf) - l - 1);
buf[i] = '\0';
SAFE_FREE(x);
}