Jeremie Courreges-Anglas <j...@wxcvbn.org> wrote:
> On Wed, Jan 03 2018, Carlos Cardenas <cardena...@gmail.com> wrote:
> > Howdy.
> >
> > Attached is a patch to address a TOCTOU issue with checking to
> > ensure disks are regular files, reported by jca@ .
> >
> > Comments? Ok?
>
> A bit late, but ok.
>
> While here, if the S_ISREG check fails there is no meaningful errno to
> report.
>
> ok?
>
ok ccardenas
>
> Index: config.c
> ===================================================================
> RCS file: /d/cvs/src/usr.sbin/vmd/config.c,v
> retrieving revision 1.39
> diff -u -p -p -u -r1.39 config.c
> --- config.c 4 Jan 2018 15:19:56 -0000 1.39
> +++ config.c 5 Jan 2018 07:24:41 -0000
> @@ -252,7 +252,7 @@ config_setvm(struct privsep *ps, struct
> goto fail;
> }
> if (S_ISREG(stat_buf.st_mode) == 0) {
> - log_warn("%s: cdrom %s is not a regular file", __func__,
> + log_warnx("%s: cdrom %s is not a regular file",
> __func__,
> vcp->vcp_cdrom);
> errno = VMD_CDROM_INVALID;
> goto fail;
> @@ -276,7 +276,7 @@ config_setvm(struct privsep *ps, struct
> goto fail;
> }
> if (S_ISREG(stat_buf.st_mode) == 0) {
> - log_warn("%s: disk %s is not a regular file", __func__,
> + log_warnx("%s: disk %s is not a regular file", __func__,
> vcp->vcp_disks[i]);
> errno = VMD_DISK_INVALID;
> goto fail;
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE