Date: Sat, 09 Jan 2021 10:35:15 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 252542] cmp -s + regular files + skipping is broken Message-ID: <bug-252542-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252542 Bug ID: 252542 Summary: cmp -s + regular files + skipping is broken Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: william@25thandclement.com The file length comparison short-circuit in cmp.c for when the -s flag, regular files, and SKIP1 are specified is broken. c_regular in regular.c had a similar buggy short-circuit that was fixed in June 2000. But in July 2000 the -z flag feature was added which accidentally reintroduced the same bug. The bug is comparing the file sizes without accounting for skip1 and skip2. See https://svnweb.freebsd.org/base/head/usr.bin/cmp/cmp.c?revision=344551&view=markup#l193 Note that both sflag and zflag are set when -s is specified. Discovered when investigating a bug report on the OpenBSD mailing-list. More detailed dissection at https://marc.info/?l=openbsd-misc&m=161017967207304&w=2 -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252542-227>
