summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-05 22:50:22 +0000
committerDenis Vlasenko2006-10-05 22:50:22 +0000
commitde59c0f58fa5dc75b753f94da61be92bfa0935ec (patch)
treefea308471e3d73fb6770ff6e4cda23da53b65bec /libbb
parent01c27fc5ac89b07821a5430880d771e3c993c1c1 (diff)
downloadbusybox-de59c0f58fa5dc75b753f94da61be92bfa0935ec.zip
busybox-de59c0f58fa5dc75b753f94da61be92bfa0935ec.tar.gz
httpd: add -u user[:grp] support
Diffstat (limited to 'libbb')
-rw-r--r--libbb/safe_strncpy.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c
index add92ac..42bc16e 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);
}