Commit Diff
Diff:
69be7a85a2117f0526ca4e113a806be989dc2f53
d67d077a711f21e722d969dc1bf7ab787042d70b
Commit:
d67d077a711f21e722d969dc1bf7ab787042d70b
Tree:
bb5091b99c9d6e108d3021bbdcf5a34fb86a9dd3
Author:
Alexander Barton <alex@barton.de>
Committer:
Alexander Barton <alex@barton.de>
Date:
Wed Apr 18 15:54:54 2012 UTC
Message:
Fix 8ec17063: "Lists_Add(): use size of destination when copying data" Thanks to Florian Westphal for spotting my silliness ...
blob - 45a4874b6e94f268aa2a0942cdf249c4aec12a24
blob + 5c6c52c4c9b2c9f15a4bdddcd05bef422125b929
--- src/ngircd/lists.c
+++ src/ngircd/lists.c
@@ -147,11 +147,8 @@ Lists_Add(struct list_head *h, const char *Mask, time_
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!");
}
IRCNow