Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
On Wed, Sep 16, 2015 at 11:13:37AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > + free(file); > > + file = xstrfmt("%s/%s", maildir, list.items[i].string); > > Repeated pattern makes one wonder if a thin wrapper > > xstrfmt_to(&file, "%s/%s", maildir, list.i

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Junio C Hamano
Jeff King writes: > + free(file); > + file = xstrfmt("%s/%s", maildir, list.items[i].string); Repeated pattern makes one wonder if a thin wrapper xstrfmt_to(&file, "%s/%s", maildir, list.items[i].string); that first frees the existing value and then overwrites i

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
On Wed, Sep 16, 2015 at 06:14:18AM -0400, Jeff King wrote: > I guess we could get away with always calling free() right before > assigning (the equivalent of strbuf_reset()), and then rely on exiting > the loop to "out" to do the final free. And then the result (versus the > original code, not my

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-16 Thread Jeff King
On Tue, Sep 15, 2015 at 08:51:26PM -0400, Eric Sunshine wrote: > > if (strbuf_getwholeline(&buf, f, '\n')) { > > - error("cannot read mail %s (%s)", file, > > strerror(errno)); > > + error("cannot read mail %s (%s)", file.buf, > > strer

Re: [PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-15 Thread Eric Sunshine
On Tue, Sep 15, 2015 at 11:28 AM, Jeff King wrote: > There are several static PATH_MAX-sized buffers in > mailsplit, along with some questionable uses of sprintf. > These are not really of security interest, as local > mailsplit pathnames are not typically under control of an > attacker. But it d

[PATCH 10/67] mailsplit: make PATH_MAX buffers dynamic

2015-09-15 Thread Jeff King
There are several static PATH_MAX-sized buffers in mailsplit, along with some questionable uses of sprintf. These are not really of security interest, as local mailsplit pathnames are not typically under control of an attacker. But it does not hurt to be careful, and as a bonus we lift some limits