PATH_MAX and POSIX (was: snprintf() results may get truncated)

2017-09-21 Thread Eike Rathke
Hi Vincent, On Tuesday, 2017-09-19 12:18:34 +0200, Vincent Lefevre wrote: > Now, I don't see much point in defining both _POSIX_PATH_MAX and > PATH_MAX for similar meanings. POSIX is strange, sometimes. :) Might be ;-) but in this case the important difference is _POSIX_PATH_MAX Minimum number

Re: snprintf() results may get truncated

2017-09-19 Thread Vincent Lefevre
On 2017-09-18 20:11:12 +0200, Eike Rathke wrote: > On Monday, 2017-09-18 13:13:07 +0200, Vincent Lefevre wrote: > > > > [... _POSIX_PATH_MAX ...] > > > (which usually is defined to 256 including null char). > > > > And it must be 256 in the current POSIX version: > > > > {_POSIX_PATH_MAX} > >

Re: snprintf() results may get truncated

2017-09-18 Thread Eike Rathke
Hi Vincent, On Monday, 2017-09-18 13:13:07 +0200, Vincent Lefevre wrote: > > [... _POSIX_PATH_MAX ...] > > (which usually is defined to 256 including null char). > > And it must be 256 in the current POSIX version: > > {_POSIX_PATH_MAX} > Minimum number the implementation will accept as t

Re: snprintf() results may get truncated

2017-09-18 Thread Vincent Lefevre
On 2017-09-16 03:17:20 +0200, Eike Rathke wrote: > On Friday, 2017-09-15 13:02:25 -0500, Derek Martin wrote: > > On Fri, Sep 15, 2017 at 09:43:58AM -0700, Kevin J. McCarthy wrote: > > > On Fri, Sep 15, 2017 at 12:58:18AM +0200, Eike Rathke wrote: > > > > Maybe path related destination buffers also

Re: snprintf() results may get truncated

2017-09-15 Thread Eike Rathke
Hi, On Friday, 2017-09-15 13:02:25 -0500, Derek Martin wrote: > On Fri, Sep 15, 2017 at 09:43:58AM -0700, Kevin J. McCarthy wrote: > > On Fri, Sep 15, 2017 at 12:58:18AM +0200, Eike Rathke wrote: > > > Maybe path related destination buffers also shouldn't be > > > of _POSIX_PATH_MAX but PATH_MAX

Re: snprintf() results may get truncated

2017-09-15 Thread Derek Martin
On Fri, Sep 15, 2017 at 01:02:25PM -0500, Derek Martin wrote: > his is just a variation of the strncpy() problem... BUT, at least > sprintf() can be checked, whereas strncpy() always truncates > silently, so sprintf() is the better choice. * snprintf()... -- Derek D. Martinhttp://www.pizza

Re: snprintf() results may get truncated

2017-09-15 Thread Derek Martin
On Fri, Sep 15, 2017 at 09:43:58AM -0700, Kevin J. McCarthy wrote: > On Fri, Sep 15, 2017 at 12:58:18AM +0200, Eike Rathke wrote: > > This is nothing overly critical (not even in mutt_rmtree() if > > a truncated string also represents an existing directory entry, as there > > was a checked opendir(

Re: snprintf() results may get truncated

2017-09-15 Thread Kevin J. McCarthy
On Fri, Sep 15, 2017 at 12:58:18AM +0200, Eike Rathke wrote: > This is nothing overly critical (not even in mutt_rmtree() if > a truncated string also represents an existing directory entry, as there > was a checked opendir(path) and all entries are to be removed, but > truncated will not be remove

snprintf() results may get truncated

2017-09-14 Thread Eike Rathke
Hi, This is nothing overly critical (not even in mutt_rmtree() if a truncated string also represents an existing directory entry, as there was a checked opendir(path) and all entries are to be removed, but truncated will not be removed as intended, so..), just a heads-up that some long paths may g