[Bug string/34466] New: string.h with _POSIX_C_SOURCE=202405L: strlcpy(), strlcat() not declared
roman.zilka at gmail dot com
sourceware-bugzilla@sourceware.org
Thu Jul 30 14:56:14 GMT 2026
https://sourceware.org/bugzilla/show_bug.cgi?id=34466
Bug ID: 34466
Summary: string.h with _POSIX_C_SOURCE=202405L: 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=c17 -pedantic -O3 -Wall -Wextra -D_POSIX_C_SOURCE=202405L
-D_FORTIFY_SOURCE=3 strlcpy-posix2024.c
strlcpy-posix2024.c: In function ‘main’:
strlcpy-posix2024.c:5:9: error: implicit declaration of function ‘strlcpy’; did
you mean ‘strncpy’? [-Wimplicit-function-declaration]
5 | strlcpy(a, argv[0], sizeof(a));
| ^~~~~~~
| strncpy
strlcpy-posix2024.c:6:9: error: implicit declaration of function ‘strlcat’; did
you mean ‘strncat’? [-Wimplicit-function-declaration]
6 | strlcat(a, argv[0], sizeof(a));
| ^~~~~~~
| strncat
strlcpy-posix2024.c:3:14: warning: unused parameter ‘argc’ [-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.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list