[Bug string/34466] New: string.h with _POSIX_C_SOURCE=202405L: strlcpy(), strlcat() not declared

"roman.zilka at gmail dot com via Glibc-bugs" <[email protected]> Thu, 30 Jul 2026 14:56:14 +0000
Newsgroups gmane.comp.lib.glibc.bugs
Message-ID <[email protected]/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=3D34466

            Bug ID: 34466
           Summary: string.h with _POSIX_C_SOURCE=3D202405L: strlcpy(),
                    strlcat() not declared
           Product: glibc
           Version: 2.43
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: string
          Assignee: unassigned at sourceware dot org
          Reporter: roman.zilka at gmail dot com
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

POSIX 2024 includes strlcpy() and strlcat() in string.h, but glibc doesn't
declare them.

$ cat strlcpy-posix2024.c
#include <string.h>

int main(int argc, char *argv[]) {
        char a[10];
        strlcpy(a, argv[0], sizeof(a));
        strlcat(a, argv[0], sizeof(a));
}

$ gcc -std=3Dc17 -pedantic -O3 -Wall -Wextra -D_POSIX_C_SOURCE=3D202405L
-D_FORTIFY_SOURCE=3D3 strlcpy-posix2024.c
strlcpy-posix2024.c: In function =E2=80=98main=E2=80=99:
strlcpy-posix2024.c:5:9: error: implicit declaration of function =E2=80=98s=
trlcpy=E2=80=99; did
you mean =E2=80=98strncpy=E2=80=99? [-Wimplicit-function-declaration]
    5 |         strlcpy(a, argv[0], sizeof(a));
      |         ^~~~~~~
      |         strncpy
strlcpy-posix2024.c:6:9: error: implicit declaration of function =E2=80=98s=
trlcat=E2=80=99; did
you mean =E2=80=98strncat=E2=80=99? [-Wimplicit-function-declaration]
    6 |         strlcat(a, argv[0], sizeof(a));
      |         ^~~~~~~
      |         strncat
strlcpy-posix2024.c:3:14: warning: unused parameter =E2=80=98argc=E2=80=99 =
[-Wunused-parameter]
    3 | int main(int argc, char *argv[]) {
      |          ~~~~^~~~

Tested on glibc 2.43, gcc 15.3.0, x86_64, Linux. I have no place to easily
check with glibc 2.44, but there's no change in include/string.h or
string/string.h in the source code of these versions.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=