out of bounds access; detected by malloc guard; ok fgsch@

This commit is contained in:
markus 2003-09-23 20:37:51 +00:00
parent 993f6ddff8
commit ee577057f2

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-rfc822_c,v 1.1 2003/09/23 20:37:51 markus Exp $
--- rfc822.c.orig Thu Jul 17 03:03:20 2003
+++ rfc822.c Tue Sep 23 11:23:05 2003
@@ -176,7 +176,7 @@
case 3: /* we're in a <>-enclosed address */
if (*from == '@' || *from == '!')
has_host_part = TRUE;
- else if (*from == '>' && from[-1] != '<')
+ else if (*from == '>' && (from > buf && from[-1] != '<'))
{
state = 1;
if (!has_host_part)
@@ -198,7 +198,7 @@
/*
* If we passed a comma, reset everything.
*/
- if (from[-1] == ',' && !parendepth) {
+ if ((from > buf && from[-1] == ',') && !parendepth) {
has_host_part = has_bare_name_part = FALSE;
parens_from = NULL;
}