[Bug 276043] fread(3) is truncated when reading from pseudo-filesystems
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] fread(3) is truncated when reading from pseudo-filesystems"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 276043] md5(1) et al are broken when reading the last argument because of capsicum(4) code"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 31 Dec 2023 20:59:27 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276043 Bug ID: 276043 Summary: fread(3) is truncated when reading from pseudo-filesystems Product: Base System Version: 14.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rbranco@suse.com I was looking why the output of `md5 /compat/linux/proc/cpuinfo` is different from `cat /compat/linux/proc/cpuinfo | md5` and came across this code in sbin/md5/md5.c: ``` char block[4096]; ... while ((len = fread(block, 1, sizeof(block), f)) > 0) { ``` ``` The issue is a truncated read as confirmed by truss and GNU wc: ``` $ sudo truss md5 /compat/linux/proc/cpuinfo ... read(3,"processor\t: 0\nvendor_id\t: Gen"...,4096) = 3549 (0xddd) ... ``` It obviously affects all tools using libc when comparing the output of wc vs. GNU wc: ``` $ wc -m /compat/linux/proc/cpuinfo 3549 /compat/linux/proc/cpuinfo $ gwc -m /compat/linux/proc/cpuinfo 3685 /compat/linux/proc/cpuinfo ``` -- You are receiving this mail because: You are the assignee for the bug.