Linux-kernel mailing list archive 1999-22,: Re: Minor bug in lib/string.c

# Re: Minor bug in lib/string.c

Matthew Wilcox (Matthew.Wilcox@genedata.com)
Sun, 30 May 1999 18:13:56 +0200

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Jeff Garzik: "[2.3.4.pre2] alpha compile fixes"
- Previous message: Chris Evans: "Re: [PATCH]: alternative security - special gids"
- Next in thread: Wayne Schlitt: "Re: Minor bug in lib/string.c"
- Reply: Wayne Schlitt: "Re: Minor bug in lib/string.c"

On Fri, May 28, 1999 at 09:53:26PM -0700, Nicholas Miell wrote:
> > I found a minor bug in lib/string.c, in the strncpy() function. These
> > two lines need to be added after the first while loop.
> >
> > while(count--)
> > *dest++ = '\0';
> >
> > ANSI says strncpy() needs to have the destination string null padded
> > to 'count' bytes if the source string has ended.
>
> I don't think anyone really cares. The kernel isn't ANSI, and padding the
> string
> would just slow down the function.

Strncpy Considered Harmful. http://pocket.fluff.org/~mrw/strncpy.html

    --
    Matthew Wilcox <willy@bofh.ai>
    "Windows and MacOS are products, contrived by engineers in the service of
    specific companies. Unix, by contrast, is not so much a product as it is a
    painstakingly compiled oral history of the hacker subculture." - N Stephenson

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

- Next message: Jeff Garzik: "[2.3.4.pre2] alpha compile fixes"
- Previous message: Chris Evans: "Re: [PATCH]: alternative security - special gids"
- Next in thread: Wayne Schlitt: "Re: Minor bug in lib/string.c"
- Reply: Wayne Schlitt: "Re: Minor bug in lib/string.c"