Skip to content

Commit b7a98d0

Browse files
FedeDPandrewrk
authored andcommitted
lib: guard definition of strl{cat,cpy} against glibc version when _FORTIFY_SOURCE is enabled.
Signed-off-by: Federico Di Pierro <[email protected]>
1 parent a76e98e commit b7a98d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/libc/include/generic-glibc/bits/string_fortified.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ __NTH (strncat (__fortify_clang_overload_arg (char *, __restrict, __dest),
150150
__glibc_objsize (__dest));
151151
}
152152

153+
/*
154+
* strlcpy and strlcat introduced in glibc 2.38
155+
* https://sourceware.org/git/?p=glibc.git;a=commit;h=2e0bbbfbf95fc9e22692e93658a6fbdd2d4554da
156+
*/
157+
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2
153158
#ifdef __USE_MISC
154159
extern size_t __strlcpy_chk (char *__dest, const char *__src, size_t __n,
155160
size_t __destlen) __THROW;
@@ -186,5 +191,6 @@ __NTH (strlcat (__fortify_clang_overload_arg (char *, __restrict, __dest),
186191
return __strlcat_alias (__dest, __src, __n);
187192
}
188193
#endif /* __USE_MISC */
194+
#endif /* glibc v2.38 and later */
189195

190-
#endif /* bits/string_fortified.h */
196+
#endif /* bits/string_fortified.h */

0 commit comments

Comments
 (0)