Re: generic strncpy - off-by-one error

From: Valdis . Kletnieks
Date: Tue Aug 12 2003 - 11:24:49 EST


On Tue, 12 Aug 2003 16:54:05 BST, William Gallafent said:

> Er, consider the case of count == 1. Fenceposts can be dangerous things.

Amen, given the original code and the first attempt to fix it. I was actually
trolling for "accidentally correct" versus "intentionally correct".

/Valdis (who has posted "convince me the code is right THIS time" waay too
many times on waaay too many lists already today - including one count-the-on-bits
scheme that only worked for an all-zeros input.. ;)

Attachment: pgp00003.pgp
Description: PGP signature