[PATCH] Prevent buffer overflows when path is too long

2013-12-14 Thread Antoine Pelisse
Some buffers created with PATH_MAX length are not checked when being written, and can overflow if PATH_MAX is not big enough to hold the path. Replace those buffers by strbufs so that their size is automatically grown if necessary. They are created as static local variables to avoid reallocating m

Re: [PATCH] Prevent buffer overflows when path is too long

2013-11-29 Thread Antoine Pelisse
On Tue, Nov 26, 2013 at 8:50 PM, Junio C Hamano wrote: > Antoine Pelisse writes: > >> Some buffers created with PATH_MAX length are not checked when being >> written, and can overflow if PATH_MAX is not big enough to hold the >> path. > > Perhaps it is time to update all of them to use strbuf? T

Re: [PATCH] Prevent buffer overflows when path is too long

2013-11-26 Thread Junio C Hamano
Antoine Pelisse writes: > Some buffers created with PATH_MAX length are not checked when being > written, and can overflow if PATH_MAX is not big enough to hold the > path. Perhaps it is time to update all of them to use strbuf? The callers of prefix_filename() aren't that many, and all of them

[PATCH] Prevent buffer overflows when path is too long

2013-11-26 Thread Antoine Pelisse
Some buffers created with PATH_MAX length are not checked when being written, and can overflow if PATH_MAX is not big enough to hold the path. Some of the use-case are probably impossible to reach, and the program dies if the path looks too long. When it would be possible for the user to use a lon