[Bug 293915] strrchr(3) has bug for amd64 ARCHLEVEL=scalar

[email protected] Thu, 19 Mar 2026 08:32:11 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293915

            Bug ID: 293915
           Summary: strrchr(3) has bug for amd64 ARCHLEVEL=scalar
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: standards
          Assignee: [email protected]
          Reporter: [email protected]

> uname -mrU
14.4-STABLE amd64 1404500

> cat s.c
#include <stdio.h>
#include <string.h>

int main(void)
{
        char    t[] = "/tmp";
        char    *p = strrchr(t, '\0');

        printf("*** &t = %p, p = %p\n", &t, p);

        return 0;
}

> cc -o s s.c

> ARCHLEVEL=scalar ./s
*** &t = 0x820339157, p = 0x82033915f


The function strrchr(3) returns a pointer outside the buffer for the
ARCHLEVEL=scalar mode.

-- 
You are receiving this mail because:
You are the assignee for the bug.