]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lib: don't use strlcpy() when strcpy() just works
authorVincent Bernat <bernat@luffy.cx>
Sun, 2 Mar 2014 23:48:55 +0000 (00:48 +0100)
committerVincent Bernat <bernat@luffy.cx>
Sun, 2 Mar 2014 23:48:55 +0000 (00:48 +0100)
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

index f6544d039f6999b2260d1d668667dcaa5a62ebd4..fe57e46deea18f1320fa7d6bd680561bf5f180db 100644 (file)
@@ -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: