Commit 35d40276 authored by Philippe Gerum's avatar Philippe Gerum

cobalt/ancillaries: prevent false positive with -Wstringop-truncation

knamecpy() is meant to copying NUL terminated strings even if this
incurs potential truncation of the source argument if need be, prevent
GCC 8.x from detecting a false positive when -Wstringop-truncation is
in effect.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent 6e933fe3
......@@ -58,7 +58,7 @@ void __knamecpy_requires_character_array_as_destination(void);
({ \
if (!__builtin_types_compatible_p(typeof(__dst), char[])) \
__knamecpy_requires_character_array_as_destination(); \
strncpy((__dst), __src, sizeof(__dst) - 1); \
strncpy((__dst), __src, sizeof(__dst)); \
__dst[sizeof(__dst) - 1] = '\0'; \
__dst; \
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment