gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Emgergency release of tla-1.2.1pre1


From: Miles Bader
Subject: Re: [Gnu-arch-users] Emgergency release of tla-1.2.1pre1
Date: Sun, 18 Apr 2004 07:14:54 -0400
User-agent: Mutt/1.3.28i

On Sun, Apr 18, 2004 at 10:56:35AM +0200, Matthieu Moy wrote:
>  * characters are written.  This function stores up to `n+1' characters:
>  * up to `n' non-0 characters from `from', plus a final 0. 
>                                            ^^^^^^^^^^^^^^^

I think that's a dangerous interface: as it stores up to `n + 1' characters,
it requires the user to worry about subtracting one from their buffer size.
Sometimes they will forget to do this and just pass in `sizeof buf' or
something.

It would be  better to copy only `n - 1' real characters in the case of an
overflow, so that the final `\0' makes `n'.

-Miles
-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]