Ah, that's right. Good catch, sorry about that. I will fix it momentarily. -Maxim
On Wed, Apr 12, 2017 at 8:51 AM, Conrad Meyer <c...@freebsd.org> wrote: > Hi Maxim, > > This breaks several stbuf checks in main() following the stat() call > you removed to isdir(). Coverity reported this as CID 1374247. > > On Tue, Apr 11, 2017 at 2:55 PM, Maxim Sobolev <sobo...@freebsd.org> > wrote: > > Author: sobomax > > Date: Tue Apr 11 21:55:39 2017 > > New Revision: 316718 > > URL: https://svnweb.freebsd.org/changeset/base/316718 > > > > ... > > --- head/sbin/mksnap_ffs/mksnap_ffs.c Tue Apr 11 20:28:15 2017 > (r316717) > > +++ head/sbin/mksnap_ffs/mksnap_ffs.c Tue Apr 11 21:55:39 2017 > (r316718) > > @@ -58,6 +58,33 @@ usage(void) > > errx(EX_USAGE, "usage: mksnap_ffs snapshot_name"); > > } > > > > +static int > > +isdir(const char *path) > > +{ > > + struct stat stbuf; > > + > > + if (stat(path, &stbuf) < 0) > > + return (-1); > ^^^^^^^^^^^^^^^^^^ moved here > > > + if (!S_ISDIR(stbuf.st_mode)) > > + return (0); > > + return (1); > > +} > > ... > > @@ -96,16 +123,33 @@ main(int argc, char **argv) > > } > > if (statfs(path, &stfsbuf) < 0) > > err(1, "%s", path); > > - if (stat(path, &stbuf) < 0) > ^^^^^^^^^^^^^^^^^^^ from here > > > + switch (isdir(path)) { > > + case -1: > > err(1, "%s", path); > > - if (!S_ISDIR(stbuf.st_mode)) > > + case 0: > > errx(1, "%s: Not a directory", path); > > + default: > > + break; > > + } > > if (access(path, W_OK) < 0) > > err(1, "Lack write permission in %s", path); > > if ((stbuf.st_mode & S_ISTXT) && stbuf.st_uid != getuid()) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ now uninitialized use > > _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"