From d67d077a711f21e722d969dc1bf7ab787042d70b Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 18 Apr 2012 17:54:54 +0200 Subject: [PATCH] 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 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ngircd/lists.c b/src/ngircd/lists.c index 45a4874b..5c6c52c4 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!"); } -- 2.39.2