aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-08 21:42:17 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-12 14:45:36 +0200
commita660177a6e24527b97172d242a6e40f9c41fb6c1 (patch)
treec2535d7cd19499d4f2a14088a11c2d180f48179d /src/misc.c
parent0a4ea19982900db1a7942c956c8c2f3ba80aedae (diff)
downloadlibssh-a660177a6e24527b97172d242a6e40f9c41fb6c1.tar.gz
libssh-a660177a6e24527b97172d242a6e40f9c41fb6c1.tar.xz
libssh-a660177a6e24527b97172d242a6e40f9c41fb6c1.zip
misc: Use strncpy instead of strcat.
This is just hardening the code. Found by Coverity.
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc.c b/src/misc.c
index fab3a922..14ca6162 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -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);
}