summaryrefslogtreecommitdiffstats
path: root/lib/data.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2010-12-19 03:09:56 +0100
committerJan Engelhardt <jengelh@medozas.de>2010-12-19 06:11:44 +0100
commit0298f9c14163f0a255662a7bfc4749f82ecb77ff (patch)
tree19f6b03ad5c94b1bf261e295861ee129d1cab0fe /lib/data.c
parent4f9d32575abfb37e01dd33fa28f4a91ff85b514b (diff)
libipset: ipset_strncpy is really a strlcpy-type operation
Diffstat (limited to 'lib/data.c')
-rw-r--r--lib/data.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/data.c b/lib/data.c
index 2872c0d..6bc423b 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -85,7 +85,7 @@ copy_addr(uint8_t family, union nf_inet_addr *ip, const void *value)
}
/**
- * ipset_strncpy - copy the string from src to dst
+ * ipset_strlcpy - copy the string from src to dst
* @dst: the target string buffer
* @src: the source string buffer
* @len: the length of bytes to copy, including the terminating null byte.
@@ -94,7 +94,7 @@ copy_addr(uint8_t family, union nf_inet_addr *ip, const void *value)
* copied. The target is unconditionally terminated by the null byte.
*/
void
-ipset_strncpy(char *dst, const char *src, size_t len)
+ipset_strlcpy(char *dst, const char *src, size_t len)
{
assert(dst);
assert(src);
@@ -199,7 +199,7 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
switch (opt) {
/* Common ones */
case IPSET_SETNAME:
- ipset_strncpy(data->setname, value, IPSET_MAXNAMELEN);
+ ipset_strlcpy(data->setname, value, IPSET_MAXNAMELEN);
break;
case IPSET_OPT_TYPE:
data->type = value;
@@ -265,7 +265,7 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
break;
/* Create-specific options, type */
case IPSET_OPT_TYPENAME:
- ipset_strncpy(data->u.create.typename, value,
+ ipset_strlcpy(data->u.create.typename, value,
IPSET_MAXNAMELEN);
break;
case IPSET_OPT_REVISION:
@@ -279,10 +279,10 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
memcpy(data->u.adt.ether, value, ETH_ALEN);
break;
case IPSET_OPT_NAME:
- ipset_strncpy(data->u.adt.name, value, IPSET_MAXNAMELEN);
+ ipset_strlcpy(data->u.adt.name, value, IPSET_MAXNAMELEN);
break;
case IPSET_OPT_NAMEREF:
- ipset_strncpy(data->u.adt.nameref, value, IPSET_MAXNAMELEN);
+ ipset_strlcpy(data->u.adt.nameref, value, IPSET_MAXNAMELEN);
break;
case IPSET_OPT_IP2:
if (!(data->family == AF_INET || data->family == AF_INET6))
@@ -297,7 +297,7 @@ ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value)
break;
/* Swap/rename */
case IPSET_OPT_SETNAME2:
- ipset_strncpy(data->u.setname2, value, IPSET_MAXNAMELEN);
+ ipset_strlcpy(data->u.setname2, value, IPSET_MAXNAMELEN);
break;
/* flags */
case IPSET_OPT_EXIST: