NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/55815: tar opens device files

The following reply was made to PR bin/55815; it has been noted by GNATS.

From: Jason Thorpe <>
To: Christos Zoulas <>
 "" <>
Subject: Re: bin/55815: tar opens device files
Date: Sat, 5 Jun 2021 07:27:06 -0700

 > On Jun 5, 2021, at 7:18 AM, Christos Zoulas <> =
 >> If we=E2=80=99re talking about =E2=80=9Censure the file we=E2=80=99re =
 opening is a regular file=E2=80=9D, won=E2=80=99t O_REGULAR do that you =
 > Yes, but that suffers from TOCTOA too:
 > if (open(path, O_REGULAR) =3D=3D -1)
 > 	fstat(path, &st);
 > But that's probably good enough.
 Sorry, I was looking at your example of:
 	fd =3D open(...);
 	if (device)
 What's the point if stat'ing the path if opening with O_REGULAR fails?  =
 Isn't the point here to prevent tar from opening device files?
 -- thorpej

Home | Main Index | Thread Index | Old Index