From 27faad4fd79399eda8811d4315c96317ed47a151 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 3 Mar 2014 00:48:55 +0100 Subject: [PATCH] lib: don't use strlcpy() when strcpy() just works clang complains when we use strlcpy() with strlen() on the source. The change was made because some other tools complained that we used strcpy() instead of a more secure version. Since they don't agree, let's switch to the saner thing to do: use strcpy() when it is safe to do. --- src/lib/atom-private.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/atom-private.c b/src/lib/atom-private.c index f6544d03..fe57e46d 100644 --- a/src/lib/atom-private.c +++ b/src/lib/atom-private.c @@ -1924,7 +1924,7 @@ read_fixed_precision(lldpctl_atom_t *atom, free(result); return NULL; } - strlcpy(stored, result, strlen(result) + 1); + strcpy(stored, result); return stored; } @@ -2303,7 +2303,7 @@ _lldpctl_atom_set_str_med_caelement(lldpctl_atom_t *atom, lldpctl_key_t key, if (strlen(value) > 250) goto bad; el->value = _lldpctl_alloc_in_atom(atom, strlen(value) + 1); if (el->value == NULL) return NULL; - strlcpy((char*)el->value, value, strlen(value) + 1); + strcpy((char*)el->value, value); el->len = strlen(value); return atom; case lldpctl_k_med_civicaddress_type: -- 2.47.2