Commit 5617bd56 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] fix strncpy on generic user platforms

parent c67574a3
...@@ -80,8 +80,7 @@ char * strcpy(char * dest,const char *src) ...@@ -80,8 +80,7 @@ char * strcpy(char * dest,const char *src)
* @src: Where to copy the string from * @src: Where to copy the string from
* @count: The maximum number of bytes to copy * @count: The maximum number of bytes to copy
* *
* Note that unlike userspace strncpy, this does not %NUL-pad the buffer. * The result is not %NUL-terminated if the source exceeds
* However, the result is not %NUL-terminated if the source exceeds
* @count bytes. * @count bytes.
*/ */
char * strncpy(char * dest,const char *src,size_t count) char * strncpy(char * dest,const char *src,size_t count)
...@@ -90,7 +89,8 @@ char * strncpy(char * dest,const char *src,size_t count) ...@@ -90,7 +89,8 @@ char * strncpy(char * dest,const char *src,size_t count)
while (count-- && (*dest++ = *src++) != '\0') while (count-- && (*dest++ = *src++) != '\0')
/* nothing */; /* nothing */;
while (count-- > 0)
*dest++ = 0;
return tmp; return tmp;
} }
#endif #endif
......
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