From 9827bf615379aa0780095331f96ddfff682bda84 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Tue, 27 Jun 2017 19:00:59 +0200 Subject: [PATCH] Fixed motd parsing Fixed #2220 Thanks to @anacondaqq --- src/map/pc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index 7ba05be92b..ada75c31a7 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -11322,10 +11322,10 @@ int pc_read_motd(void) if( ( fp = fopen(motd_txt, "r") ) != NULL ) { unsigned int entries = 0; + char buf[CHAT_SIZE_MAX]; - while( entries < MOTD_LINE_SIZE && fgets(motd_text[entries], sizeof(motd_text[entries]), fp) ) + while( entries < MOTD_LINE_SIZE && fgets(buf, CHAT_SIZE_MAX, fp) ) { - char* buf = motd_text[entries]; unsigned int lines = 0; size_t len; lines++; @@ -11344,6 +11344,7 @@ int pc_read_motd(void) buf[0] = ' '; buf[1] = 0; } + safestrncpy(motd_text[entries], buf, CHAT_SIZE_MAX); entries++; } fclose(fp);