Fixed buffer overflow with too long newsheader

This commit is contained in:
Michiel Broek 2003-09-02 20:25:42 +00:00
parent 43daa4cfbd
commit 8c2ce9da3b
21 changed files with 65 additions and 47 deletions

View File

@ -32,6 +32,10 @@ v0.37.6 10-Aug-2003
ftscprod.007 ftscprod.007
Changed the website address in several sources. Changed the website address in several sources.
libmsgbase.a:
Resolved a buffer overflow problem with kludges larger then
512 bytes.
nodelist.a: nodelist.a:
Removed some of the debug logging. Removed some of the debug logging.
@ -55,6 +59,12 @@ v0.37.6 10-Aug-2003
session password. Also improved the password check. session password. Also improved the password check.
The product code was not entered in the FTS-0001 packet headers. The product code was not entered in the FTS-0001 packet headers.
mbfido:
The rfc to ftn gate now drops the headerlines starting with
X-Spam- because they are only filled with advertisents and are
very large (upto 1200 bytes which is somewhat larger for a
fidonet kludge).
mbsetup: mbsetup:
In the nodes setup a switch is added to fallback to the wrong In the nodes setup a switch is added to fallback to the wrong
binkp escape method. binkp escape method.

View File

@ -310,8 +310,8 @@ void Msg_Write(FILE *fp)
char *Buf; char *Buf;
int i; int i;
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
for (i = 0; i < strlen(Buf); i++) { for (i = 0; i < strlen(Buf); i++) {
if (*(Buf + i) == '\0') if (*(Buf + i) == '\0')

View File

@ -3,7 +3,11 @@
#ifndef _MSG_H #ifndef _MSG_H
#define _MSG_H #define _MSG_H
#define MAX_LINE_LENGTH 512 /*
* Global maximum line length for all files that do something with
* message text.
*/
#define MAX_LINE_LENGTH 2048
/* /*

View File

@ -105,13 +105,13 @@ dial.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records
dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h emsi.h dietifna.h respfreq.h filelist.h xmrecv.h xmsend.h
emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h
filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h
openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h config.h lutil.h openfile.h openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/users.h ../lib/records.h config.h lutil.h openfile.h
openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h
opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h
rdoptions.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h rdoptions.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h
yoohoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h yoohoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h
recvbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h recvbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h recvbark.h respfreq.h filelist.h
respfreq.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h session.h lutil.h config.h atoul.h respfreq.h filelist.h respfreq.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ../lib/msg.h session.h lutil.h config.h atoul.h respfreq.h filelist.h
sendbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h sendbark.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h sendbark.h xmrecv.h
tcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h tcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/nodelist.h ../lib/clcomm.h ttyio.h session.h statetbl.h config.h emsi.h respfreq.h filelist.h tcpproto.h tcp.h
tcpproto.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h tcpproto.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/mberrors.h ttyio.h session.h config.h emsi.h lutil.h openfile.h filelist.h tcpproto.h

View File

@ -36,6 +36,7 @@
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/nodelist.h" #include "../lib/nodelist.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "../lib/msg.h"
#include "session.h" #include "session.h"
#include "lutil.h" #include "lutil.h"
#include "config.h" #include "config.h"
@ -538,8 +539,8 @@ file_list *respmagic(char *cmd) /* must free(cmd) before exit */
if ((ft = fopen(tmpfn, "r")) == NULL) { if ((ft = fopen(tmpfn, "r")) == NULL) {
WriteError("$Can't open %s", tmpfn); WriteError("$Can't open %s", tmpfn);
} else { } else {
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(buf, 2048, ft)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, ft)) != NULL) {
for (i = 0; i < strlen(buf); i++) { for (i = 0; i < strlen(buf); i++) {
if (*(buf + i) == '\0') if (*(buf + i) == '\0')
break; break;

View File

@ -177,7 +177,7 @@ grlist.o: ../config.h ../lib/libs.h ../lib/clcomm.h grlist.h
maketags.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h maketags.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h
mbmsg.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/dbcfg.h ../lib/mberrors.h post.h mbmsg.h mbmsg.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/dbcfg.h ../lib/mberrors.h post.h mbmsg.h
newspost.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h newspost.h newspost.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h newspost.h
postemail.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h postemail.h postemail.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msg.h postemail.h
scan.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msg.h ../lib/clcomm.h ../lib/msgtext.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h tracker.h ftn2rfc.h rfc2ftn.h rollover.h postemail.h scan.h scan.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msg.h ../lib/clcomm.h ../lib/msgtext.h ../lib/dbnode.h ../lib/dbmsgs.h addpkt.h tracker.h ftn2rfc.h rfc2ftn.h rollover.h postemail.h scan.h
toberep.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h toberep.h toberep.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h toberep.h
atoul.o: ../config.h ../lib/libs.h atoul.h atoul.o: ../config.h ../lib/libs.h atoul.h
@ -186,7 +186,7 @@ hash.o: ../config.h ../lib/libs.h hash.h lhash.h
mbaff.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/mberrors.h announce.h filefind.h mbaff.h mbaff.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/mberrors.h announce.h filefind.h mbaff.h
mbseq.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbseq.h mbseq.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbseq.h
notify.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbnode.h filemgr.h areamgr.h sendmail.h mgrutil.h notify.h notify.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbnode.h filemgr.h areamgr.h sendmail.h mgrutil.h notify.h
postnetmail.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/common.h ../lib/records.h ../lib/dbcfg.h ../lib/dbuser.h ../lib/dbnode.h ../lib/dbftn.h ../lib/clcomm.h tracker.h addpkt.h storenet.h ftn2rfc.h areamgr.h filemgr.h ping.h bounce.h postemail.h postnetmail.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/common.h ../lib/records.h ../lib/dbcfg.h ../lib/dbuser.h ../lib/dbnode.h ../lib/dbftn.h ../lib/clcomm.h ../lib/msg.h tracker.h addpkt.h storenet.h ftn2rfc.h areamgr.h filemgr.h ping.h bounce.h postemail.h
scannews.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h storeecho.h rfc2ftn.h scannews.h scannews.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h storeecho.h rfc2ftn.h scannews.h
tosspkt.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h tosspkt.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h tosspkt.h postnetmail.h postecho.h rollover.h createm.h
mbfkill.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbfkill.h mbfutil.h mbfkill.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbfkill.h mbfutil.h

View File

@ -1054,10 +1054,10 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
return FALSE; return FALSE;
} }
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
/* /*
* Make sure we have the nodes record loaded * Make sure we have the nodes record loaded
@ -1150,7 +1150,7 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
fprintf(np, "\r"); fprintf(np, "\r");
fseek(tmp, 0, SEEK_SET); fseek(tmp, 0, SEEK_SET);
while ((fgets(Buf, 2048, tmp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, tmp)) != NULL) {
while ((Buf[strlen(Buf) - 1]=='\n') || (Buf[strlen(Buf) - 1]=='\r')) { while ((Buf[strlen(Buf) - 1]=='\n') || (Buf[strlen(Buf) - 1]=='\r')) {
Buf[strlen(Buf) - 1] = '\0'; Buf[strlen(Buf) - 1] = '\0';
} }

View File

@ -79,7 +79,7 @@ int Bounce(faddr *f, faddr *t, FILE *fp, char *reason)
f->domain = xstrcpy(fidonet.domain); f->domain = xstrcpy(fidonet.domain);
Syslog('+', "Bounce msg from %s", ascfnode(f, 0xff)); Syslog('+', "Bounce msg from %s", ascfnode(f, 0xff));
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
np = tmpfile(); np = tmpfile();
@ -100,7 +100,7 @@ int Bounce(faddr *f, faddr *t, FILE *fp, char *reason)
* Add MSGID, REPLY and PID * Add MSGID, REPLY and PID
*/ */
fprintf(np, "\001MSGID: %s %08lx\r", ascfnode(from, 0x1f), sequencer()); fprintf(np, "\001MSGID: %s %08lx\r", ascfnode(from, 0x1f), sequencer());
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(Buf); Striplf(Buf);
if (strncmp(Buf, "\001MSGID:", 7) == 0) { if (strncmp(Buf, "\001MSGID:", 7) == 0) {
fprintf(np, "\001REPLY:%s\r", Buf+7); fprintf(np, "\001REPLY:%s\r", Buf+7);
@ -115,7 +115,7 @@ int Bounce(faddr *f, faddr *t, FILE *fp, char *reason)
fprintf(np, "======================================================================\r"); fprintf(np, "======================================================================\r");
rewind(fp); rewind(fp);
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(Buf); Striplf(Buf);
if (Buf[0] == '\001') { if (Buf[0] == '\001') {
fprintf(np, "^a"); fprintf(np, "^a");

View File

@ -872,10 +872,10 @@ int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
return FALSE; return FALSE;
} }
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
/* /*
* Make sure we refresh the nodes record. * Make sure we refresh the nodes record.
@ -962,7 +962,7 @@ int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
fprintf(np, "\r"); fprintf(np, "\r");
fseek(tmp, 0, SEEK_SET); fseek(tmp, 0, SEEK_SET);
while ((fgets(Buf, 2048, tmp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, tmp)) != NULL) {
while ((Buf[strlen(Buf) - 1]=='\n') || (Buf[strlen(Buf) - 1]=='\r')) { while ((Buf[strlen(Buf) - 1]=='\n') || (Buf[strlen(Buf) - 1]=='\r')) {
Buf[strlen(Buf) - 1] = '\0'; Buf[strlen(Buf) - 1] = '\0';
} }

View File

@ -79,7 +79,7 @@ int Ping(faddr *f, faddr *t, FILE *fp, int intransit)
f->domain = xstrcpy(fidonet.domain); f->domain = xstrcpy(fidonet.domain);
Syslog('+', "%s ping msg from %s", intransit ? "Intransit":"Final", ascfnode(f, 0xff)); Syslog('+', "%s ping msg from %s", intransit ? "Intransit":"Final", ascfnode(f, 0xff));
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
np = tmpfile(); np = tmpfile();
@ -104,7 +104,7 @@ int Ping(faddr *f, faddr *t, FILE *fp, int intransit)
* Add MSGID, REPLY and PID * Add MSGID, REPLY and PID
*/ */
fprintf(np, "\001MSGID: %s %08lx\r", ascfnode(from, 0x1f), sequencer()); fprintf(np, "\001MSGID: %s %08lx\r", ascfnode(from, 0x1f), sequencer());
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(Buf); Striplf(Buf);
if (strncmp(Buf, "\001MSGID:", 7) == 0) { if (strncmp(Buf, "\001MSGID:", 7) == 0) {
fprintf(np, "\001REPLY:%s\r", Buf+7); fprintf(np, "\001REPLY:%s\r", Buf+7);
@ -124,7 +124,7 @@ int Ping(faddr *f, faddr *t, FILE *fp, int intransit)
fprintf(np, "======================================================================\r"); fprintf(np, "======================================================================\r");
rewind(fp); rewind(fp);
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(Buf); Striplf(Buf);
if (strncmp(Buf, "\1Via", 4) == 0) { if (strncmp(Buf, "\1Via", 4) == 0) {
fprintf(np, "%s\r", Buf+1); fprintf(np, "%s\r", Buf+1);

View File

@ -112,9 +112,9 @@ int EchoOut(fidoaddr aka, char *toname, char *fromname, char *subj, FILE *fp, in
} }
rewind(fp); rewind(fp);
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
fprintf(qp, "%s\r", buf); fprintf(qp, "%s\r", buf);
} }
@ -207,10 +207,10 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
/* /*
* Read the message for kludges we need. * Read the message for kludges we need.
*/ */
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
First = TRUE; First = TRUE;
rewind(fp); rewind(fp);
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
@ -264,7 +264,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
* dupecheck. Redy Rodriguez. * dupecheck. Redy Rodriguez.
*/ */
rewind(fp); rewind(fp);
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
if (strncmp(buf, "---", 3) == 0) if (strncmp(buf, "---", 3) == 0)
break; break;
@ -396,7 +396,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
rewind(fp); rewind(fp);
if ((nfp = tmpfile()) == NULL) if ((nfp = tmpfile()) == NULL)
WriteError("$Unable to open tmpfile"); WriteError("$Unable to open tmpfile");
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
fprintf(nfp, "%s", buf); fprintf(nfp, "%s", buf);
/* /*
@ -502,7 +502,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
if (strlen(msgs.Newsgroup) && tonews) { if (strlen(msgs.Newsgroup) && tonews) {
rewind(nfp); rewind(nfp);
qp = tmpfile(); qp = tmpfile();
while ((fgets(buf, 2048, nfp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, nfp)) != NULL) {
Striplf(buf); Striplf(buf);
if (kludges && (buf[0] != '\001') && strncmp(buf, "AREA:", 5)) { if (kludges && (buf[0] != '\001') && strncmp(buf, "AREA:", 5)) {
kludges = FALSE; kludges = FALSE;

View File

@ -37,6 +37,7 @@
#include "../lib/common.h" #include "../lib/common.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "../lib/mbinet.h" #include "../lib/mbinet.h"
#include "../lib/msg.h"
#include "postemail.h" #include "postemail.h"
@ -90,7 +91,7 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo)
return 2; return 2;
} }
temp = calloc(2048, sizeof(char)); temp = calloc(MAX_LINE_LENGTH +1, sizeof(char));
sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom); sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom);
if (smtp_cmd(temp, 250)) { if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused FROM <%s>", MailFrom); WriteError("SMTP: refused FROM <%s>", MailFrom);

View File

@ -39,6 +39,7 @@
#include "../lib/dbnode.h" #include "../lib/dbnode.h"
#include "../lib/dbftn.h" #include "../lib/dbftn.h"
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "../lib/msg.h"
#include "tracker.h" #include "tracker.h"
#include "addpkt.h" #include "addpkt.h"
#include "storenet.h" #include "storenet.h"
@ -89,9 +90,9 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
/* /*
* Extract MSGID and REPLY kludges from this netmail. * Extract MSGID and REPLY kludges from this netmail.
*/ */
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
Syslogp('M', printable(buf, 0)); Syslogp('M', printable(buf, 0));
if (!strncmp(buf, "\001MSGID: ", 8)) { if (!strncmp(buf, "\001MSGID: ", 8)) {
@ -432,8 +433,8 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
* Copy all text including kludges, when * Copy all text including kludges, when
* finished, insert our ^aVia line. * finished, insert our ^aVia line.
*/ */
buf = calloc(2048, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(buf, 2048, fp)) != NULL) while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL)
fprintf(net, "%s\r", buf); fprintf(net, "%s\r", buf);
now = time(NULL); now = time(NULL);

View File

@ -76,7 +76,7 @@ extern int do_learn;
extern int news_in; extern int news_in;
extern int email_in; extern int email_in;
extern char *replyaddr; extern char *replyaddr;
extern int most_debug;
/* /*
@ -835,6 +835,7 @@ int needputrfc(rfcmsg *msg, int newsmode)
if (!strcasecmp(msg->key,"Precedence")) return 0; if (!strcasecmp(msg->key,"Precedence")) return 0;
if (!strcasecmp(msg->key,"X-Face")) return 0; if (!strcasecmp(msg->key,"X-Face")) return 0;
if (!strcasecmp(msg->key,"X-Accept-Language")) return 0; if (!strcasecmp(msg->key,"X-Accept-Language")) return 0;
if (!strncasecmp(msg->key,"X-Spam-", 7)) return 0;
/*if (!strcasecmp(msg->key,"")) return ;*/ /*if (!strcasecmp(msg->key,"")) return ;*/
return 1; return 1;
} }

View File

@ -152,10 +152,10 @@ int storeecho(faddr *f, faddr *t, time_t mdate, int flags, char *subj, char *msg
* If not a bad or dupe message, eat the first * If not a bad or dupe message, eat the first
* line (AREA:tag). * line (AREA:tag).
*/ */
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
rewind(fp); rewind(fp);
if (!dupe && !bad) if (!dupe && !bad)
fgets(buf , 2048, fp); fgets(buf , MAX_LINE_LENGTH, fp);
Msg_Write(fp); Msg_Write(fp);
Msg_AddMsg(); Msg_AddMsg();
Msg_UnLock(); Msg_UnLock();

View File

@ -145,8 +145,8 @@ int storenet(faddr *f, faddr *t, time_t mdate, int flags, char *Subj, char *msgi
* Check if this is an empty netmail * Check if this is an empty netmail
*/ */
rewind(fp); rewind(fp);
Buf = calloc(2049, sizeof(char)); Buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
while ((fgets(Buf, 2048, fp)) != NULL) { while ((fgets(Buf, MAX_LINE_LENGTH, fp)) != NULL) {
for (i = 0; i < strlen(Buf); i++) { for (i = 0; i < strlen(Buf); i++) {
if (*(Buf + i) == '\0') if (*(Buf + i) == '\0')

View File

@ -174,7 +174,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
Known = TRUE; Known = TRUE;
} }
buf = calloc(2049, sizeof(char)); buf = calloc(MAX_LINE_LENGTH +1, sizeof(char));
marea = NULL; marea = NULL;
/* /*
@ -183,7 +183,7 @@ int importmsg(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t
rewind(fp); rewind(fp);
FirstLine = TRUE; FirstLine = TRUE;
while ((fgets(buf, 2048, fp)) != NULL) { while ((fgets(buf, MAX_LINE_LENGTH, fp)) != NULL) {
Striplf(buf); Striplf(buf);
@ -320,7 +320,7 @@ int TossPkt(char *fn)
*/ */
int getmessage(FILE *pkt, faddr *p_from, faddr *p_to) int getmessage(FILE *pkt, faddr *p_from, faddr *p_to)
{ {
char buf[2048], *orig = NULL, *p, *l, *r, *subj = NULL; char buf[MAX_LINE_LENGTH +1], *orig = NULL, *p, *l, *r, *subj = NULL;
int tmp, rc, maxrc = 0, result, flags, cost; int tmp, rc, maxrc = 0, result, flags, cost;
static faddr f, t; static faddr f, t;
faddr *o; faddr *o;

View File

@ -692,7 +692,7 @@ void Reply_Email(int IsReply)
sLine(); sLine();
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
Message[i] = (char *) calloc(81, sizeof(char)); Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char));
Line = 1; Line = 1;
Msg_New(); Msg_New();
@ -821,7 +821,7 @@ void Write_Email(void)
clear(); clear();
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
Message[i] = (char *) calloc(81, sizeof(char)); Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char));
Line = 1; Line = 1;
Msg_New(); Msg_New();

View File

@ -7,7 +7,7 @@
int Fs_Edit(void); /* The fullscreen message editor */ int Fs_Edit(void); /* The fullscreen message editor */
extern int Line; /* Number of lines + 1 */ extern int Line; /* Number of lines + 1 */
extern char *Message[]; /* TEXTBUFSIZE lines of 80 chars */ extern char *Message[]; /* TEXTBUFSIZE lines of MAX_LINE_LENGTH chars */
int Row; /* Current row on screen */ int Row; /* Current row on screen */
int Col; /* Current column in text and on screen */ int Col; /* Current column in text and on screen */

View File

@ -410,7 +410,7 @@ void Post_Msg()
return; return;
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
Message[i] = (char *) calloc(81, sizeof(char)); Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char));
Line = 1; Line = 1;
Msg_New(); Msg_New();
@ -1321,7 +1321,7 @@ void Reply_Msg(int IsReply)
sLine(); sLine();
for (i = 0; i < (TEXTBUFSIZE + 1); i++) for (i = 0; i < (TEXTBUFSIZE + 1); i++)
Message[i] = (char *) calloc(81, sizeof(char)); Message[i] = (char *) calloc(MAX_LINE_LENGTH +1, sizeof(char));
Msg_New(); Msg_New();
strncpy(Msg.Replyid, msgid, 80); strncpy(Msg.Replyid, msgid, 80);

View File

@ -2280,7 +2280,7 @@ void QWK_Fetch()
colour(LIGHTBLUE, BLACK); colour(LIGHTBLUE, BLACK);
/* Processing BlueWave reply packet */ /* Processing BlueWave reply packet */
printf("%s\n", (char *)Language(459)); printf("%s\n", (char *)Language(459));
temp = calloc(2048, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
otemp = calloc(PATH_MAX, sizeof(char)); otemp = calloc(PATH_MAX, sizeof(char));
nWidth = 78; nWidth = 78;