* 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 <h/mh.h>
-#include <zotnet/mts/mts.h>
+#include <h/mts.h>
+#include <h/utils.h>
/* 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
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;
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 */
while (pc != *str++)
if (str > es)
return 0;
-
+ if (str > es+1)
+ return 0;
sp = str; pp = pat;
while (pp < ep && *sp++ == *pp)
pp++;