Fix 8ec17063: "Lists_Add(): use size of destination when copying data"

Thanks to Florian Westphal for spotting my silliness ...
This commit is contained in:
Alexander Barton 2012-04-18 17:54:54 +02:00
parent 69be7a85a2
commit d67d077a71
1 changed files with 2 additions and 5 deletions

View File

@ -147,11 +147,8 @@ Lists_Add(struct list_head *h, const char *Mask, time_t ValidUntil,
strlcpy(newelem->mask, Mask, sizeof(newelem->mask)); strlcpy(newelem->mask, Mask, sizeof(newelem->mask));
if (Reason) { if (Reason) {
newelem->reason = malloc(strlen(Reason) + 1); newelem->reason = strdup(Reason);
if (newelem->reason) if (!newelem->reason)
strlcpy(newelem->reason, Reason,
sizeof(newelem->reason));
else
Log(LOG_EMERG, Log(LOG_EMERG,
"Can't allocate memory for new list reason text!"); "Can't allocate memory for new list reason text!");
} }