Use stdup(3) and check its return instead from homebrew version using strcpy(3)

and malloc(3)

Obtained from:	NetBSD
This commit is contained in:
Baptiste Daroussin 2015-05-05 09:26:32 +00:00
parent 8916ff53c3
commit 0a2963a2ac

View file

@ -574,7 +574,8 @@ addmac(const char *mac)
dest = src+1;
while (dest > loc)
*dest-- = *src--;
*loc = strcpy(malloc(3), mac);
if ((*loc = strdup(mac)) == NULL)
err(1, "strdup");
ncmds++;
#ifdef DEBUG
printf("after: %s %s %s %s %s, %d cmds\n",