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));
if (Reason) {
newelem->reason = malloc(strlen(Reason) + 1);
if (newelem->reason)
strlcpy(newelem->reason, Reason,
sizeof(newelem->reason));
else
newelem->reason = strdup(Reason);
if (!newelem->reason)
Log(LOG_EMERG,
"Can't allocate memory for new list reason text!");
}