Fix 8ec17063: "Lists_Add(): use size of destination when copying data"
Thanks to Florian Westphal for spotting my silliness ...
This commit is contained in:
parent
69be7a85a2
commit
d67d077a71
|
@ -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!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue