[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code
Date: Tue, 02 Jan 2024 21:46:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276043
Ricardo Branco <rbranco@suse.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|fread(3) is truncated when |md5(1) et al are broken
|reading from |when reading the last
|pseudo-filesystems |argument because of
| |capsicum(4) code
--- Comment #2 from Ricardo Branco <rbranco@suse.com> ---
I figured out the problematic code at:
```
/*
* XXX Enter capability mode on the last argv file.
* When a casper file service or other approach is
* available, switch to that and enter capability mode
* earlier.
*/
if (*(argv + 1) == NULL) {
#ifdef HAVE_CAPSICUM
cap_rights_init(&rights, CAP_READ, CAP_FSTAT);
if (caph_rights_limit(fileno(f), &rights) < 0
||
caph_enter() < 0)
err(1, "capsicum");
#endif
}
```
So md5 works if I pass /dev/null as the last argument:
$ md5 /compat/linux/proc/cpuinfo
MD5 (/compat/linux/proc/cpuinfo) = 36966b53dc9e57113b2b7637d8b51720
$ md5 /compat/linux/proc/cpuinfo /dev/null
MD5 (/compat/linux/proc/cpuinfo) = 142e18c701aa58b0e691920e2bf98e56
MD5 (/dev/null) = d41d8cd98f00b204e9800998ecf8427e
--
You are receiving this mail because:
You are the assignee for the bug.