summaryrefslogtreecommitdiffhomepage
path: root/scpmisc.c
diff options
context:
space:
mode:
authorFrançois Perrad <francois.perrad@gadz.org>2019-03-20 15:09:19 +0100
committerMatt Johnston <matt@ucc.asn.au>2019-03-20 22:09:19 +0800
commit28b6111db0f4ced931f2ce4b890a8d109904b8e2 (patch)
tree3ff28d553d9a52c18d302a13aef6bc46a6f1025c /scpmisc.c
parenta0aa2749813331134452f80bb8a808bdc871ba41 (diff)
use strlcpy & strlcat (#74)
* refactor checkpubkeyperms() with safe BSD functions fix gcc8 warnings ``` svr-authpubkey.c: In function 'checkpubkeyperms': svr-authpubkey.c:427:2: warning: 'strncat' specified bound 5 equals source length [-Wstringop-overflow=] strncat(filename, "/.ssh", 5); /* strlen("/.ssh") == 5 */ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svr-authpubkey.c:433:2: warning: 'strncat' specified bound 16 equals source length [-Wstringop-overflow=] strncat(filename, "/authorized_keys", 16); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` see https://www.sudo.ws/todd/papers/strlcpy.html * restore strlcpy in xstrdup see original https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/xmalloc.c?rev=1.16
Diffstat (limited to 'scpmisc.c')
-rw-r--r--scpmisc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scpmisc.c b/scpmisc.c
index 33e1891..c2f053e 100644
--- a/scpmisc.c
+++ b/scpmisc.c
@@ -102,7 +102,7 @@ xstrdup(const char *str)
len = strlen(str) + 1;
cp = xmalloc(len);
- strncpy(cp, str, len);
+ strlcpy(cp, str, len);
return cp;
}