diff options
| author | Robert Clausecker <fuz@FreeBSD.org> | 2026-03-22 12:37:06 +0000 |
|---|---|---|
| committer | Robert Clausecker <fuz@FreeBSD.org> | 2026-03-26 11:41:49 +0000 |
| commit | 253f15c016ca699906f78b8e522a3f7ed675929b (patch) | |
| tree | 378539fe8826134f162a9ae9ecd6f97448e238c3 /usr.sbin/chroot/(public-mirror) | |
| parent | 9b98c4b053917cad42e26596b37df72efab6dc39 (diff) | |
The original scalar implementation of strrchr() had incorrect
logic that failed if the character searched for was the NUL
character. It was also possibly affected by the issue fixed
in 3d8ef251a for strchrnul().
Rewrite the function with logic that actually works. We defer
checking for the character until after we have checked for NUL.
When we encounter the final NUL byte, we mask out the characters
beyond the tail before checking for a match.
This bug only affects users running on amd64 with ARCHLEVEL=scalar
(cf. simd(7)). The default configuration is not affected.
The bug was unfortunately not caught by the unit test inherited
from NetBSD. An extended unit test catching the issue is proposed
in D56037.
PR: 293915
Reported by: safonov.paul@gmail.com
Tested by: safonov.paul@gmail.com
Fixes: 2ed514a220edbac6ca5ec9f40a3e0b3f2804796d
See also: https://reviews.freebsd.org/D56037
MFC after: 1 week
Diffstat (limited to 'usr.sbin/chroot/(public-mirror)')
0 files changed, 0 insertions, 0 deletions
