summaryrefslogtreecommitdiff
path: root/lib/string.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-08-14 10:24:05 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-08-14 10:24:05 -0700
commitb33d0943b18b04ed3f1887b6704f11cb86eedb83 (patch)
tree6803de5043ff6d41a5815405081bdafe53c2beb4 /lib/string.c
parent54d8435b12b30cde9ff04cf65e0d410d4cb367fc (diff)
[PATCH] Fix strncpy off-by-one error
From: Yoshinori Sato <ysato@users.sourceforge.jp> It writes one too many zeroes when nulling out the destination.
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/string.c b/lib/string.c
index d50185536bf3..05dfb7ff5fd9 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -89,7 +89,7 @@ char * strncpy(char * dest,const char *src,size_t count)
while (count && (*dest++ = *src++) != '\0')
count--;
- while (count) {
+ while (count > 1) {
*dest++ = 0;
count--;
}