From 0298f9c14163f0a255662a7bfc4749f82ecb77ff Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 19 Dec 2010 03:09:56 +0100 Subject: libipset: ipset_strncpy is really a strlcpy-type operation --- lib/types.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/types.c') diff --git a/lib/types.c b/lib/types.c index 3034477..d979c24 100644 --- a/lib/types.c +++ b/lib/types.c @@ -54,7 +54,7 @@ ipset_cache_add(const char *name, const struct ipset_type *type, if (n == NULL) return -ENOMEM; - ipset_strncpy(n->name, name, IPSET_MAXNAMELEN); + ipset_strlcpy(n->name, name, IPSET_MAXNAMELEN); n->type = type; n->family = family; n->next = NULL; @@ -133,7 +133,7 @@ ipset_cache_rename(const char *from, const char *to) for (s = setlist; s != NULL; s = s->next) { if (STREQ(s->name, from)) { - ipset_strncpy(s->name, to, IPSET_MAXNAMELEN); + ipset_strlcpy(s->name, to, IPSET_MAXNAMELEN); return 0; } } @@ -164,8 +164,8 @@ ipset_cache_swap(const char *from, const char *to) b = s; } if (a != NULL && b != NULL) { - ipset_strncpy(a->name, to, IPSET_MAXNAMELEN); - ipset_strncpy(b->name, from, IPSET_MAXNAMELEN); + ipset_strlcpy(a->name, to, IPSET_MAXNAMELEN); + ipset_strlcpy(b->name, from, IPSET_MAXNAMELEN); return 0; } -- cgit v1.2.3 From 404c46381d01088867fdcd92ea6b97978f4c95a7 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 19 Dec 2010 05:56:19 +0100 Subject: libipset: const annotations --- lib/types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/types.c') diff --git a/lib/types.c b/lib/types.c index d979c24..1bd4274 100644 --- a/lib/types.c +++ b/lib/types.c @@ -393,7 +393,7 @@ ipset_type_get(struct ipset_session *session, enum ipset_cmd cmd) const struct ipset_type * ipset_type_check(struct ipset_session *session) { - struct ipset_type *t, *match = NULL; + const struct ipset_type *t, *match = NULL; struct ipset_data *data; const char *typename; uint8_t family, revision; -- cgit v1.2.3