Re: generic strncpy - off-by-one error

From: Andreas Schwab
Date: Tue Aug 12 2003 - 11:14:48 EST


Valdis.Kletnieks@xxxxxx writes:

|> On Tue, 12 Aug 2003 23:50:06 +0900, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx> said:
|>
|> > - while (count) {
|> > + while (count > 1) {
|>
|> Given that count is a size_t, which seems to be derived from 'unsigned int' or
|> 'unsigned long' on every platform, how are these any different?

Let's suppose count == 1.

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

Attachment: pgp00003.pgp
Description: PGP signature