From 68ed965b35cdc7b55d4ebc0ba37c1ac078ccbafb Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 2 Jun 2021 15:15:37 +0200 Subject: extensions: libxt_string: Avoid buffer size warning for strncpy() If the target buffer does not need to be null-terminated, one may simply use memcpy() and thereby avoid any compiler warnings. Signed-off-by: Phil Sutter --- extensions/libxt_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c index 7c6366cb..739a8e7f 100644 --- a/extensions/libxt_string.c +++ b/extensions/libxt_string.c @@ -81,7 +81,7 @@ parse_string(const char *s, struct xt_string_info *info) { /* xt_string does not need \0 at the end of the pattern */ if (strlen(s) <= XT_STRING_MAX_PATTERN_SIZE) { - strncpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE); + memcpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE); info->patlen = strnlen(s, XT_STRING_MAX_PATTERN_SIZE); return; } -- cgit v1.2.3