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/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D252542 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, reg= ular files, and SKIP1 are specified is broken. c_regular in regular.c had a simi= lar buggy short-circuit that was fixed in June 2000. But in July 2000 the -z fl= ag 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=3D344551&vi= ew=3Dmarkup#l193 Note that both sflag and zflag are set when -s is specified.=20 Discovered when investigating a bug report on the OpenBSD mailing-list. More detailed dissection at https://marc.info/?l=3Dopenbsd-misc&m=3D161017967207= 304&w=3D2 --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-252542-227>