From de59c0f58fa5dc75b753f94da61be92bfa0935ec Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 5 Oct 2006 22:50:22 +0000 Subject: httpd: add -u user[:grp] support --- libbb/safe_strncpy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libbb/safe_strncpy.c') 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