Fixed motd parsing

Fixed #2220

Thanks to @anacondaqq
This commit is contained in:
Lemongrass3110 2017-06-27 19:00:59 +02:00
parent da036de523
commit 9827bf6153

View File

@ -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);