summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-07-19 15:43:53 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-07-19 15:43:53 +0000
commitce86ae58dcf0076845ec5e2bc089228035a5fb4f (patch)
tree3d026543e6c9fa25aa0cdf322b9812c593ec6a0b /src
parent49b76108c272964598dc866c8728472ec1320f58 (diff)
- motd.(c|h): fixed core with zero byte length ircd.motd. Reported by Fawkes
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@2409 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r--src/motd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/motd.c b/src/motd.c
index 4d5bde9..02c01ed 100644
--- a/src/motd.c
+++ b/src/motd.c
@@ -143,7 +143,7 @@ motd_cache(struct Motd *motd)
}
/* Ok, allocate a structure; we'll realloc later to trim memory */
- cache = MyMalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * (MOTD_MAXLINES - 1)));
+ cache = MyMalloc(sizeof(struct MotdCache) + (MOTD_LINESIZE * MOTD_MAXLINES));
cache->ref = 1;
cache->path = xstrdup(motd->path);
cache->maxcount = motd->maxcount;
@@ -163,9 +163,9 @@ motd_cache(struct Motd *motd)
/* trim memory usage a little */
motd->cache = MyMalloc(sizeof(struct MotdCache) +
- (MOTD_LINESIZE * (cache->count - 1)));
+ (MOTD_LINESIZE * cache->count));
memcpy(motd->cache, cache, sizeof(struct MotdCache) +
- (MOTD_LINESIZE * (cache->count - 1)));
+ (MOTD_LINESIZE * cache->count));
MyFree(cache);
/* now link it in... */