From: mmj Date: Tue, 18 Jan 2005 10:47:42 +0000 (+1100) Subject: Fix off by one error X-Git-Tag: RELEASE_1_2_0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdf240b9fc822c133b7a235a8050cce3aa9e6496;p=thirdparty%2Fmlmmj.git Fix off by one error --- diff --git a/src/mail-functions.c b/src/mail-functions.c index 23009e56..8a0e49fd 100644 --- a/src/mail-functions.c +++ b/src/mail-functions.c @@ -212,7 +212,7 @@ char *get_prepped_mailbody_from_map(char *mapstart, size_t size, size_t *blen) for(next = cur = endhdrs; next < mapstart + size; next++) { if(*next == '\n') { n++; - if(*(next+1) == '.') + if((next < mapstart + size - 1) && *(next+1) == '.') n++; } } @@ -228,7 +228,7 @@ char *get_prepped_mailbody_from_map(char *mapstart, size_t size, size_t *blen) newlinebuf[0] = '\r'; newlinebuf[1] = '\n'; len = 2; - if(*(next+1) == '.') { + if((next < mapstart + size - 1) && *(next+1) == '.') { newlinebuf[2] = '.'; len = 3; }