Re: generic strncpy - off-by-one error

Valdis.Kletnieks
2003-08-12T16:19:58Z

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

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 #2: Type: application/pgp-signature, Size: 226 bytes --]