git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Buffer overflows

From
Johan Herland <johan@herland.net>
Date
Sep 2, 2007, 13:42 UTC
Message-ID
<200709021542.31100.johan@herland.net>
In-Reply-To
<7vtzqg7jrn.fsf@gitster.siamese.dyndns.org>
On Friday 31 August 2007, Junio C Hamano wrote:
Show 15 quoted lines
> It is well and widely understood idiom to use strlcpy to a
> fixed-sized buffer and checking the resulting length to make
> sure the result would not have overflowed (and if it would have,
> issue an error and die).  I would not have anything against a
> set of patches to follow such a pattern.
> 
> But a patch to add a non-standard API that nobody else uses,
> without any patch to show the changes to a few places that could
> use the API to demonstrate that the use of API vastly cleans the
> code up and makes it infinitely harder to make mistakes?
> 
> The API needs to justify itself to convince the people who needs
> to learn and adjust to that the benefit far outweighes deviation
> from better known patterns, and I do not see that happening in
> Timo's patch.
So in general, git people seem to be saying that:
1. Yes, we agree that the C string library suX0rs badly.
2. There are more than 0 string manipulation bugs (e.g. buffer overflows) in 
git. The number may be small or large, but I have yet to see anyone claim 
it's _zero_.
3. Timo's patches (in their current form) are not the way to go, because of 
non-standard API, implementation problems, whatever...

So why does the discussion end there? Lukas proposed an interesting alternative in "The Better String Library" ( http://bstring.sourceforge.net/ ). Why has there been lots of bashing on Timo's efforts, but no critique of bstring? I'd be very keen to know what the git developers think of it. AFAICS, it seems to fulfill at least _some_ of the problems people find in Timo's patches. Specifically, it claims:

- High performance (better than the C string library)
- Simple usage
I'd also say it's probably more widely used than Timo's patches.

If the only response to Timo's highlighting of string manipulation problems in git, is for us to flame his patches and leave it at that, then I have no choice but to agree with him in that security does not seem to matter to us.

...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Timo SirainenNext: Reece Dunn
Message 13 of 26 in “Buffer overflows”
  1. Timo SirainenAug 30, 2007
  2. Lukas SandströmAug 30, 2007
  3. Linus TorvaldsAug 30, 2007
  4. Timo SirainenAug 30, 2007
  5. Reece DunnAug 30, 2007
  6. Timo SirainenAug 30, 2007
  7. Reece DunnAug 30, 2007
  8. Wincent ColaiutaAug 31, 2007
  9. Simon 'corecode' SchubertAug 31, 2007
  10. Junio C HamanoAug 30, 2007
  11. Pierre HabouzitAug 30, 2007
  12. Timo SirainenAug 30, 2007
  13. Johan HerlandSep 2, 2007
  14. Reece DunnSep 2, 2007
  15. David KastrupSep 2, 2007
  16. Reece DunnSep 2, 2007
  17. Jakub NarebskiSep 3, 2007
  18. Junio C HamanoSep 3, 2007
  19. René ScharfeSep 2, 2007
  20. Lukas SandströmSep 2, 2007
  21. Linus TorvaldsAug 31, 2007
  22. Timo SirainenAug 31, 2007
  23. Andreas EricssonAug 31, 2007
  24. Johannes SchindelinAug 31, 2007
  25. Temporary fix for stack smashing in mailinfoAlex Riesen, Aug 30, 2007
  26. Junio C HamanoAug 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.