]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Backward compatibility: handle missing strscpy with a wrapper of strlcpy.
authorJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 14 Dec 2020 09:12:57 +0000 (10:12 +0100)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 14 Dec 2020 09:12:57 +0000 (10:12 +0100)
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in

index bf99bc0f18c98a152103a27b8938e60dcd85aa56..eecf3302878e409458d3993045a8dbe353fb1b38 100644 (file)
@@ -446,7 +446,12 @@ static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
 #endif
 
 #ifndef HAVE_STRSCPY
-#define        strscpy(dst, src, n)    (strncpy(dst, src, n) == (dst))
+static inline ssize_t strscpy(char * dest, const char * src, size_t count)
+{
+       size_t ret = strlcpy(dest, src, count);
+
+       return (ret >= count ? -E2BIG : ret);
+}
 #endif
 
 #ifndef smp_mb__before_atomic