summaryrefslogtreecommitdiffstats
path: root/extensions/libxt_string.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-06-02 15:15:37 +0200
committerPhil Sutter <phil@nwl.cc>2021-06-07 14:50:27 +0200
commit68ed965b35cdc7b55d4ebc0ba37c1ac078ccbafb (patch)
tree0a32ff52ad5f9c949bed2d6264c8388837071350 /extensions/libxt_string.c
parent9b85e1ab3dbf0d9344562c5c76114496e3ebaa3a (diff)
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 <phil@nwl.cc>
Diffstat (limited to 'extensions/libxt_string.c')
-rw-r--r--extensions/libxt_string.c2
1 files changed, 1 insertions, 1 deletions
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;
}