From: Vincent Bernat Date: Sun, 2 Mar 2014 23:48:55 +0000 (+0100) Subject: lib: don't use strlcpy() when strcpy() just works X-Git-Tag: 0.7.8~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27faad4fd79399eda8811d4315c96317ed47a151;p=thirdparty%2Flldpd.git 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. --- 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: