summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/motd.h2
-rw-r--r--src/motd.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/motd.h b/include/motd.h
index b8b715a..e113bc4 100644
--- a/include/motd.h
+++ b/include/motd.h
@@ -69,7 +69,7 @@ struct MotdCache
unsigned int maxcount; /**< Number of lines allocated for message. */
unsigned int count; /**< Actual number of lines used in message. */
struct tm modtime; /**< Last modification time from file. */
- char motd[1][MOTD_LINESIZE]; /**< Message body. */
+ char motd[][MOTD_LINESIZE]; /**< Message body. */
};
/* motd_send sends a MOTD off to a user */
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... */