# HG changeset patch # User mortenp # Date 1225462851 -39600 # Node ID a81c74ff299580ec5340366b82e4b594ecf9eb99 # Parent d0a7bd17f13d9ac41bc29906f842bd8622bbc83c Added more sanity checks (Thomas Jarosch) diff -r d0a7bd17f13d -r a81c74ff2995 ChangeLog --- a/ChangeLog Sat Nov 01 01:09:56 2008 +1100 +++ b/ChangeLog Sat Nov 01 01:20:51 2008 +1100 @@ -1,3 +1,4 @@ + o Added more sanity checks (Thomas Jarosch) o Disabled digest mails when 'noarchive' is set (Thomas Jarosch) o Added Russian listtexts (Nikolay Derkach) o Fixed mmap()ing of zero-sized files (Robin H. Johnson) diff -r d0a7bd17f13d -r a81c74ff2995 src/mlmmj-bounce.c --- a/src/mlmmj-bounce.c Sat Nov 01 01:09:56 2008 +1100 +++ b/src/mlmmj-bounce.c Sat Nov 01 01:20:51 2008 +1100 @@ -92,6 +92,7 @@ continue; colon = strchr(line, ':'); + MY_ASSERT(colon); *colon = '\0'; s = indexstr; indexstr = concatstr(4, s, " ", line, "\n"); @@ -320,6 +321,7 @@ exit(EXIT_SUCCESS); a = strrchr(address, '@'); + MY_ASSERT(a); *a = '='; } diff -r d0a7bd17f13d -r a81c74ff2995 src/mlmmj-maintd.c --- a/src/mlmmj-maintd.c Sat Nov 01 01:09:56 2008 +1100 +++ b/src/mlmmj-maintd.c Sat Nov 01 01:20:51 2008 +1100 @@ -245,6 +245,7 @@ if(strchr(dp->d_name, '.')) { ch = strrchr(mailname, '.'); + MY_ASSERT(ch); *ch = '\0'; if(stat(mailname, &st) < 0) { if(errno == ENOENT) { diff -r d0a7bd17f13d -r a81c74ff2995 src/mlmmj-send.c --- a/src/mlmmj-send.c Sat Nov 01 01:09:56 2008 +1100 +++ b/src/mlmmj-send.c Sat Nov 01 01:20:51 2008 +1100 @@ -1067,6 +1067,7 @@ /* error, so remove the probefile */ tmpstr = mystrdup(to_addr); a = strchr(tmpstr, '@'); + MY_ASSERT(a); *a = '='; probefile = concatstr(4, listdir, "/bounce/", tmpstr, "-probe"); diff -r d0a7bd17f13d -r a81c74ff2995 src/strgen.c --- a/src/strgen.c Sat Nov 01 01:09:56 2008 +1100 +++ b/src/strgen.c Sat Nov 01 01:20:51 2008 +1100 @@ -32,9 +32,11 @@ #include #include +#include "mlmmj.h" #include "strgen.h" #include "wrappers.h" #include "memory.h" +#include "log_error.h" char *random_str() { @@ -57,6 +59,7 @@ snprintf(tmpstr, len, "%s", addr); atsign = strchr(tmpstr, '@'); + MY_ASSERT(atsign); *atsign = '='; snprintf(dest, len, "%x%x-%s", random_int(), random_int(), tmpstr); @@ -82,6 +85,7 @@ char *dest, *atsign; atsign = strchr(listaddr, '@'); + MY_ASSERT(atsign); len = atsign - listaddr + 1; dest = mymalloc(len); @@ -96,6 +100,7 @@ char *dest, *atsign; atsign = strchr(listaddr, '@'); + MY_ASSERT(atsign); len = strlen(listaddr) - (atsign - listaddr); dest = mymalloc(len); snprintf(dest, len, "%s", atsign + 1); @@ -143,9 +148,9 @@ for (;;) { len *= 2; - free(hostname); + myfree(hostname); - hostname = malloc(len); + hostname = mymalloc(len); hostname[len-1] = '\0'; /* gethostname() is allowed to: @@ -278,7 +283,7 @@ const char *weekday = NULL, *month = NULL; /* 6 + 26 + ' ' + timezone which is 5 + '\n\0' == 40 */ - timestr = (char *)malloc(40); + timestr = (char *)mymalloc(40); t = time(NULL); localtime_r(&t, <tm);