diff options
| author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2003-07-31 05:18:18 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-31 05:18:18 -0700 |
| commit | 5617bd56041a623f660f759e5bc69359bbfdb94c (patch) | |
| tree | 014f7f6debedb9be0217f38614456c38c581b840 | |
| parent | c67574a357dbbaf1cbc9a003197a6a992bad669b (diff) | |
[PATCH] fix strncpy on generic user platforms
| -rw-r--r-- | lib/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c index 112389ed554a..b7df79574a57 100644 --- a/lib/string.c +++ b/lib/string.c @@ -80,8 +80,7 @@ char * strcpy(char * dest,const char *src) * @src: Where to copy the string from * @count: The maximum number of bytes to copy * - * Note that unlike userspace strncpy, this does not %NUL-pad the buffer. - * However, the result is not %NUL-terminated if the source exceeds + * The result is not %NUL-terminated if the source exceeds * @count bytes. */ 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') /* nothing */; - + while (count-- > 0) + *dest++ = 0; return tmp; } #endif |
