Re: [dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread Galos, David
> {PATH_MAX} > Maximum number of bytes in a pathname, including the > terminating null character.[1] I stand corrected. I have moved the declaration of 'n' to the beginning of main (which while not technically required for c89 compliance, is stylistically consistent with the rest of the project) a

Re: [dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread sin
On Tue, Jul 09, 2013 at 05:48:47PM -0400, Galos, David wrote: > > The patch introduces buffer overflow. sizeof(buf)-1 should be passed > > to readlink(). > > Furthermore, buf should be made (PATH_MAX + 1) bytes in size, so that > valid paths don't get truncated. {PATH_MAX} Maximum number of bytes

Re: [dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread Galos, David
> The patch introduces buffer overflow. sizeof(buf)-1 should be passed > to readlink(). Furthermore, buf should be made (PATH_MAX + 1) bytes in size, so that valid paths don't get truncated.

Re: [dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread Krol, Willem van de
Indeed, I overlooked that. I attached the patched patch. Sincerely, Willem van de Krol On Tue, Jul 9, 2013 at 7:35 PM, Michał Kazior wrote: > On 9 July 2013 19:19, Krol, Willem van de <008...@jfc.nl> wrote: > > Hello all, > > > > The man page of readlink(2) says it "does not append a null byt

Re: [dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread Michał Kazior
On 9 July 2013 19:19, Krol, Willem van de <008...@jfc.nl> wrote: > Hello all, > > The man page of readlink(2) says it "does not append a null byte to buf". > The readlink utility in sbase, however, assumes it does. I attached a patch. Hi, The patch introduces buffer overflow. sizeof(buf)-1 shoul

[dev][sbase] Readlink doesn't null-terminate buf

2013-07-09 Thread Krol, Willem van de
Hello all, The man page of readlink(2) says it "does not append a null byte to buf". The readlink utility in sbase, however, assumes it does. I attached a patch. Sincerely, Willem van de Krol readlink-nullterminate.diff Description: Binary data