Module: ngircd.git Branch: master Commit: d67d077a711f21e722d969dc1bf7ab787042d70b URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=d67d0...
Author: Alexander Barton alex@barton.de Date: Wed Apr 18 17:54:54 2012 +0200
Fix 8ec17063: "Lists_Add(): use size of destination when copying data"
Thanks to Florian Westphal for spotting my silliness ...
---
src/ngircd/lists.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/ngircd/lists.c b/src/ngircd/lists.c index 45a4874..5c6c52c 100644 --- a/src/ngircd/lists.c +++ b/src/ngircd/lists.c @@ -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!"); }