From: Markus Armbruster Date: Sun, 12 Jun 2005 10:11:04 +0000 (+0000) Subject: (rea, turn): Use a different buffer for message text. Just for X-Git-Tag: v4.2.21~53 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=cb454a1f56eea1b8d49b5c5565b463b3868038ba (rea, turn): Use a different buffer for message text. Just for clarity. --- diff --git a/src/lib/commands/rea.c b/src/lib/commands/rea.c index 047d614a7..ccf405c35 100644 --- a/src/lib/commands/rea.c +++ b/src/lib/commands/rea.c @@ -63,7 +63,8 @@ rea(void) int teles; int size; unsigned int nbytes; - s_char buf[4096]; /* buf is message text */ + char buf[1024]; + char msgbuf[4096]; /* message text */ int lasttype; int lastcnum; time_t lastdate; @@ -163,12 +164,12 @@ rea(void) skip: while (tgm.tel_length > 0) { nbytes = tgm.tel_length; - if (nbytes > sizeof(buf) - 1) - nbytes = sizeof(buf) - 1; - (void)fread(buf, sizeof(s_char), nbytes, telfp); - buf[nbytes] = 0; + if (nbytes > sizeof(msgbuf) - 1) + nbytes = sizeof(msgbuf) - 1; + (void)fread(msgbuf, sizeof(s_char), nbytes, telfp); + msgbuf[nbytes] = 0; if (readit) - uprnf(buf); + uprnf(msgbuf); tgm.tel_length -= nbytes; } } diff --git a/src/lib/commands/turn.c b/src/lib/commands/turn.c index 041d1f97b..d55228aae 100644 --- a/src/lib/commands/turn.c +++ b/src/lib/commands/turn.c @@ -49,7 +49,8 @@ turn(void) FILE *fptr; struct telstr tgm; char *p; - char buf[MAXTELSIZE + 1]; + char buf[1024]; + char msgbuf[MAXTELSIZE + 1]; /* message text */ char *msgfilepath; p = getstarg(player->argp[1], "on, off or motd? ", buf); @@ -75,7 +76,7 @@ turn(void) pr("Enter a new message of the day.\n"); time(&tgm.tel_date); - tgm.tel_length = getele("The World", buf); + tgm.tel_length = getele("The World", msgbuf); if (tgm.tel_length < 0) { pr("Ignored\n"); @@ -106,7 +107,7 @@ turn(void) pr("Logins disabled.\n"); if ((fwrite(&tgm, sizeof(tgm), 1, fptr) != 1) || - (fwrite(buf, tgm.tel_length, 1, fptr) != 1)) { + (fwrite(msgbuf, tgm.tel_length, 1, fptr) != 1)) { fclose(fptr); pr("Something went wrong writing the message file.\n"); logerror("Could not properly write message file (%s).\n",