Re: newfs: avoid oob read on command line argument

2015-12-05 Thread Tobias Stoeckmann
On Sat, Dec 05, 2015 at 06:26:35AM -0500, Ted Unangst wrote: > may i suggest strlen(s) instead of strchr(s, 0)? There's actually one part in newfs' code that uses this. And in theory it has the same issue, not checking if s (which is special, which might be argv[0]) is empty. I highly doubt this

newfs: avoid oob read on command line argument

2015-12-05 Thread Tobias Stoeckmann
Here's the spin-off from previous __progname patch. It's possible to have an out-of-boundary read in newfs_ext2fs when supplying an empty partition name. Before calling strchr() - 1, it should be verified that it's not empty. While at it, the result of the strchr call will never be NULL, because

Re: newfs: avoid oob read on command line argument

2015-12-05 Thread Michael McConville
Tobias Stoeckmann wrote: > On Sat, Dec 05, 2015 at 06:26:35AM -0500, Ted Unangst wrote: > > may i suggest strlen(s) instead of strchr(s, 0)? > > There's actually one part in newfs' code that uses this. And in theory > it has the same issue, not checking if s (which is special, which might > be