return NULL;
}
- char *stored = _lldpctl_alloc_in_atom(atom, strlen(result) + 1);
+ size_t len = strlen(result) + 1;
+ char *stored = _lldpctl_alloc_in_atom(atom, len);
if (stored == NULL) {
free(result);
return NULL;
}
- strcpy(stored, result);
+ strlcpy(stored, result, len);
return stored;
}
{
struct _lldpctl_atom_med_caelement_t *el =
(struct _lldpctl_atom_med_caelement_t *)atom;
+ size_t len;
/* Only local port can be modified */
if (el->parent->parent->hardware == NULL) {
switch (key) {
case lldpctl_k_med_civicaddress_value:
- if (strlen(value) > 250) goto bad;
- el->value = _lldpctl_alloc_in_atom(atom, strlen(value) + 1);
+ len = strlen(value) + 1;
+ if (len > 251) goto bad;
+ el->value = _lldpctl_alloc_in_atom(atom, len);
if (el->value == NULL) return NULL;
- strcpy((char*)el->value, value);
+ strlcpy((char*)el->value, value, len);
el->len = strlen(value);
return atom;
case lldpctl_k_med_civicaddress_type: