From 445754ff183de68a177b8482cf6df237bc4d3532 Mon Sep 17 00:00:00 2001 From: vda Date: Thu, 5 Oct 2006 22:50:22 +0000 Subject: httpd: add -u user[:grp] support git-svn-id: svn://busybox.net/trunk/busybox@16313 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- libbb/safe_strncpy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libbb') diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c index add92ac9f..42bc16ea0 100644 --- a/libbb/safe_strncpy.c +++ b/libbb/safe_strncpy.c @@ -15,6 +15,7 @@ /* Like strncpy but make sure the resulting string is always 0 terminated. */ char * safe_strncpy(char *dst, const char *src, size_t size) { - dst[size-1] = '\0'; - return strncpy(dst, src, size-1); + if (!size) return dst; + dst[--size] = '\0'; + return strncpy(dst, src, size); } -- cgit v1.2.3-55-g6feb