summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-10-23 18:48:49 +0200
committerAnton Babushkin <anton.babushkin@me.com>2013-10-23 18:48:49 +0200
commitdb5fb70706a788321f872aa2d9f825310d7677fd (patch)
tree748ea44393833abe23c585f2a6b7818ba7fd7c1f
parent53bd63f36d32fbbab3b243676a91944957d5c137 (diff)
downloadnuttx-db5fb70706a788321f872aa2d9f825310d7677fd.tar.gz
nuttx-db5fb70706a788321f872aa2d9f825310d7677fd.tar.bz2
nuttx-db5fb70706a788321f872aa2d9f825310d7677fd.zip
strncpy bug fixed: fill tail of dest with zeroes if src size < n
-rw-r--r--nuttx/libc/string/lib_strncpy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/nuttx/libc/string/lib_strncpy.c b/nuttx/libc/string/lib_strncpy.c
index 8a97aa67b..8dfc899ce 100644
--- a/nuttx/libc/string/lib_strncpy.c
+++ b/nuttx/libc/string/lib_strncpy.c
@@ -52,6 +52,7 @@ char *strncpy(char *dest, const char *src, size_t n)
char *end = dest + n; /* End of dest buffer + 1 byte */
while ((*dest++ = *src++) != '\0' && dest != end);
+ while (dest != end) *dest++ = '\0';
return ret;
}
#endif