Commit b33d0943 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent 54d8435b
...@@ -89,7 +89,7 @@ char * strncpy(char * dest,const char *src,size_t count) ...@@ -89,7 +89,7 @@ char * strncpy(char * dest,const char *src,size_t count)
while (count && (*dest++ = *src++) != '\0') while (count && (*dest++ = *src++) != '\0')
count--; count--;
while (count) { while (count > 1) {
*dest++ = 0; *dest++ = 0;
count--; count--;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment