diff --git a/ChangeLog b/ChangeLog index 4fcbeb1d..f81b0f51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,6 @@ $Id$ v0.39.3 26-Nov-2003 - WARNING: DO NOT USE, PROBLEMS EXIST IN THIS CVS VERSION !!!!!!!!!!!! general: Since this version Posix threads are being used, please let me know if this doesn't compile on you system. @@ -10,7 +9,8 @@ v0.39.3 26-Nov-2003 are stripped during make install only. This allows to run the not yet installed binaries under debuggers. The configure script has a --enable-debugging option so that - all code can be compiled to let it run under debuggers. + all code can be compiled to let it run under debuggers. Not + usefull for production systems. This version had a lot of testing using valgrind. Most errors were minor problems. @@ -24,20 +24,28 @@ v0.39.3 26-Nov-2003 libmsgbase: In JAM_Open replaced a strcpy with memmove. + Fixed invalid memory read/write in Msg_Link. libdbase: Code cleanup in dbdupe. + libnodelist: + Fixed a small memeory leak. + mbcico: Dropped binkp CRC support because it will be incompatible with future extensions. Fixed a small memory leak. + mbout: + Fixed several memory leaks. + mbfido: Fixed a some small memory leaks. mbfile: Fixed a uninitialized memory pointer in the index command. + Fixed a 3 forgotten file closes in mbfile list. mbindex: Fixed a forgotten file close. @@ -75,7 +83,7 @@ v0.39.3 26-Nov-2003 script: Changed all init scripts to allow the slower stopping of mbtask For the latest Slackware distros a setup script for pkgtool is - added. + added. Most other distro's don't need this. v0.39.2 21-Nov-2003 - 26-Nov-2003 diff --git a/TODO b/TODO index f947bf81..ea8fe012 100644 --- a/TODO +++ b/TODO @@ -114,8 +114,6 @@ mbfido: N: After readalias we need to free the alias list when mbfido ends. - N: Tic, scan tests with valgrind. - mbcico: N: Upgrade binkp protocol to 1.1. @@ -128,9 +126,6 @@ mbcico: U: Fix binkp file resume when mbcico silently dies. -mbout: - N: Fix prepbuf in libcommon so that valgind can test this. - mbfile: L: Add a check to see if the magic filenames are (still) valid. @@ -140,8 +135,6 @@ mbfile: L: Possibility to skip file areas from checking and reindexing. - N: Test with valgrind. - mbmsg: N: With the post command if a netmail area is used the netmail area will cause trouble later, should be blocked to be used on netmail diff --git a/lib/msg.c b/lib/msg.c index 3f5fe8ba..5d497af6 100644 --- a/lib/msg.c +++ b/lib/msg.c @@ -4,7 +4,7 @@ * Purpose ...............: Global message base functions * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -363,8 +363,8 @@ int Msg_Link(char *Path, int do_quiet, int slow_util) if ((Total = Msg_Number()) != 0L) { if (Msg_Lock(30L)) { - if ((Link = (MSGLINK *)malloc(Total * sizeof(MSGLINK))) != NULL) { - memset(Link, 0, Total * sizeof(MSGLINK)); + if ((Link = (MSGLINK *)malloc((Total + 1) * sizeof(MSGLINK))) != NULL) { + memset(Link, 0, (Total + 1) * sizeof(MSGLINK)); Number = Msg_Lowest(); i = 0; do { diff --git a/lib/nodelist.c b/lib/nodelist.c index 5f61529b..2ad6f963 100644 --- a/lib/nodelist.c +++ b/lib/nodelist.c @@ -1088,6 +1088,8 @@ node *getnlent(faddr *addr) fclose(fp); nodebuf.addr.name = nodebuf.sysop; + if (nodebuf.addr.domain) + free(nodebuf.addr.domain); nodebuf.addr.domain = xstrcpy(fdx.domain); nodebuf.upnet = ndx.upnet; nodebuf.upnode = ndx.upnode; diff --git a/lib/pktname.c b/lib/pktname.c index 823ea96e..ed8facf3 100644 --- a/lib/pktname.c +++ b/lib/pktname.c @@ -285,6 +285,7 @@ char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat) } } + tidy_faddr(bestaka); Syslog('O', "Arc file name is \"%s\"", buf); return buf; } diff --git a/mbcico/mbcico.c b/mbcico/mbcico.c index 61d9113c..16687629 100644 --- a/mbcico/mbcico.c +++ b/mbcico/mbcico.c @@ -104,6 +104,10 @@ void free_mem(void) free(flags); if (uxoutbound) free(uxoutbound); + if (protocol) + free(protocol); + if ((nlent) && (nlent->url)) + free(nlent->url); } @@ -137,6 +141,9 @@ void die(int onsig) t_end = time(NULL); Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end)); + /* + * Free memory + */ free_mem(); deinitnl(); diff --git a/mbcico/mbout.c b/mbcico/mbout.c index a2ebd050..4fb601fb 100644 --- a/mbcico/mbout.c +++ b/mbcico/mbout.c @@ -193,9 +193,9 @@ int main(int argc, char *argv[]) * Catch all signals we can, and ignore the rest. */ for (i = 0; i < NSIG; i++) { - if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) + if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) signal(i, (void (*))die); - else + else if ((i != SIGKILL) && (i != SIGSTOP)) signal(i, SIG_IGN); } @@ -274,6 +274,7 @@ int main(int argc, char *argv[]) } if (do_poll || do_stop) { + tidy_faddr(addr); for (i = 3; i <= argc; i++) { if (strncasecmp(argv[i-1], "-q", 2)) { if ((addr = parsefaddr(argv[i-1])) == NULL) @@ -288,6 +289,7 @@ int main(int argc, char *argv[]) } if (do_reset) { + tidy_faddr(addr); for (i = 3; i <= argc; i++) { if (strncasecmp(argv[i-1], "-q", 2)) { if ((addr = parsefaddr(argv[i-1])) == NULL) @@ -314,6 +316,13 @@ int main(int argc, char *argv[]) } nlent = getnlent(addr); + if (nlent->addr.domain) + free(nlent->addr.domain); + nlent->addr.domain = NULL; + if (nlent->url) + free(nlent->url); + nlent->url = NULL; + cmmask = getCMmask(); if (nlent->pflag == NL_DUMMY) Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST); @@ -359,6 +368,7 @@ int main(int argc, char *argv[]) break; } } + tidy_faddr(addr); die(rc); } diff --git a/mbcico/nlinfo.c b/mbcico/nlinfo.c index 470b728c..107d95a2 100644 --- a/mbcico/nlinfo.c +++ b/mbcico/nlinfo.c @@ -4,7 +4,7 @@ * Purpose ...............: MBSE BBS Outbound Manager - show node info * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -135,6 +135,8 @@ int nlinfo(faddr *addr) if (nlent->addr.domain) free(nlent->addr.domain); + if (nlent->url) + free(nlent->url); return 0; } diff --git a/mbcico/outstat.c b/mbcico/outstat.c index f09743ef..d1bdeea1 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -439,6 +439,8 @@ int poll(faddr *addr, int stop) } CreateSema((char *)"scanout"); } + if (nlent->url) + free(nlent->url); } free(pol); diff --git a/mbcico/session.c b/mbcico/session.c index 426fb3dd..cc15b686 100644 --- a/mbcico/session.c +++ b/mbcico/session.c @@ -54,8 +54,8 @@ extern int tcp_mode; extern pid_t mypid; -node *nlent; -fa_list *remote=NULL; +node *nlent = NULL; +fa_list *remote = NULL; int session_flags; int remote_flags; diff --git a/mbfido/mbflist.c b/mbfido/mbflist.c index 43513bd9..1b0dfcfd 100644 --- a/mbfido/mbflist.c +++ b/mbfido/mbflist.c @@ -4,7 +4,7 @@ * Purpose: File Database Maintenance - List areas and totals * ***************************************************************************** - * Copyright (C) 1997-2002 + * Copyright (C) 1997-2003 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -169,6 +169,7 @@ void ListFileAreas(int Area) printf("-"); printf("\n"); printf("%d file%s, %ld Kbytes\n", fcount, (fcount == 1) ? "":"s", fsize); + fclose(pFile); } else { WriteError("Area %d is not available", Area); @@ -176,6 +177,7 @@ void ListFileAreas(int Area) return; } + fclose(pAreas); fclose(pTic); free(ticarea); free(sAreas); @@ -220,6 +222,7 @@ void ListFileAreas(int Area) printf("%5d %5d %5ld %-12s %s\n", i, fcount, fsize, area.BbsGroup, area.Name); iTotal++; + fclose(pFile); } } diff --git a/mbsebbs/fsedit.c b/mbsebbs/fsedit.c index a3077789..f978e032 100644 --- a/mbsebbs/fsedit.c +++ b/mbsebbs/fsedit.c @@ -701,7 +701,7 @@ int Fs_Edit() clear(); fflush(stdout); if (ch == 'S' && Changed) { - Syslog('+', "FSEDIT: Message saved"); + Syslog('+', "FSEDIT: Message will be saved"); return TRUE; } else { Syslog('+', "FSEDIT: Message aborted"); diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 4c99743b..312ef1c6 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -773,11 +773,15 @@ int Save_Msg(int IsReply, faddr *Dest) char *temp; FILE *fp; - if ((Line < 2) || (Dest == NULL)) + Syslog('b', "Entering Save_Msg() Line=%d, Dest=%s", Line, (Dest == NULL)?"NULL":"valid"); + + if (Line < 2) return TRUE; - if (!Open_Msgbase(msgs.Base, 'w')) + if (!Open_Msgbase(msgs.Base, 'w')) { + WriteError("Failed to open msgbase \"%s\"", msgs.Base); return FALSE; + } Msg.Written = Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60); Msg.Local = TRUE;