diff options
| author | Alexander Barton <alex@barton.de> | 2012-04-18 17:54:54 +0200 |
|---|---|---|
| committer | Alexander Barton <alex@barton.de> | 2012-04-18 17:54:54 +0200 |
| commit | d67d077a711f21e722d969dc1bf7ab787042d70b (patch) | |
| tree | bb5091b99c9d6e108d3021bbdcf5a34fb86a9dd3 /src | |
| parent | 69be7a85a2117f0526ca4e113a806be989dc2f53 (diff) | |
| download | ngircd-d67d077a711f21e722d969dc1bf7ab787042d70b.tar.gz ngircd-d67d077a711f21e722d969dc1bf7ab787042d70b.zip | |
Fix 8ec17063: "Lists_Add(): use size of destination when copying data"
Thanks to Florian Westphal for spotting my silliness ...
Diffstat (limited to 'src')
| -rw-r--r-- | 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 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!"); } |