X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fm_getfld.c;h=6c15886900d723e1a69f26b382877303f99855c6;hp=0db7bd9957d3459bd2398f6fb653fefc5bfd0bb0;hb=da831514de01e2407cef37c118ffff0526a486d0;hpb=90f1d5866d7d0c7c270fac0939b7de6bf4c35be9 diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 0db7bd9..6c15886 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -3,10 +3,15 @@ * m_getfld.c -- read/parse a message * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include -#include +#include +#include /* This module has a long and checkered history. First, it didn't burst maildrops correctly because it considered two CTRL-A:s in a row to be @@ -178,7 +183,7 @@ static int fdelimlen; static unsigned char *edelim; static int edelimlen; -static int (*eom_action)() = NULL; +static int (*eom_action)(int) = NULL; #ifdef _FSTDIO # define _ptr _p /* Gag */ @@ -558,7 +563,7 @@ m_unknown(FILE *iob) msg_style = MS_MMDF; } c = strlen (delimstr); - fdelim = (unsigned char *) malloc((size_t) (c + 3)); + fdelim = (unsigned char *) mh_xmalloc((size_t) (c + 3)); *fdelim++ = '\0'; *fdelim = '\n'; msg_delim = (char *)fdelim+1; @@ -578,7 +583,7 @@ m_unknown(FILE *iob) pat_map = (unsigned char **) calloc (256, sizeof(unsigned char *)); for (cp = (char *) fdelim + 1; cp < (char *) delimend; cp++ ) - pat_map[(int)*cp] = (unsigned char *) cp; + pat_map[(unsigned char)*cp] = (unsigned char *) cp; if (msg_style == MS_MMDF) { /* flush extra msg hdrs */ @@ -591,7 +596,7 @@ m_unknown(FILE *iob) void -m_eomsbr (int (*action)()) +m_eomsbr (int (*action)(int)) { if ((eom_action = action)) { msg_style = MS_MSH; @@ -730,7 +735,8 @@ matchc(int patln, char *pat, int strln, char *str) while (pc != *str++) if (str > es) return 0; - + if (str > es+1) + return 0; sp = str; pp = pat; while (pp < ep && *sp++ == *pp) pp++;