summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorkim <kim@pkgsrc.org>1999-03-07 19:40:01 +0000
committerkim <kim@pkgsrc.org>1999-03-07 19:40:01 +0000
commit1b5408dc6add33a2e90088f0c136675dfb75518f (patch)
tree6d785b1351b09298892c596f7e1270162a9a2ea6 /mail
parent4782f7c5e58fd5b465210bdc6d658ecccd29d5b4 (diff)
downloadpkgsrc-1b5408dc6add33a2e90088f0c136675dfb75518f.tar.gz
Fix buffer overflow problems in m_getfld.c
Diffstat (limited to 'mail')
-rw-r--r--mail/nmh/patches/patch-cf31
1 files changed, 31 insertions, 0 deletions
diff --git a/mail/nmh/patches/patch-cf b/mail/nmh/patches/patch-cf
new file mode 100644
index 00000000000..cbc7b644a1e
--- /dev/null
+++ b/mail/nmh/patches/patch-cf
@@ -0,0 +1,31 @@
+$NetBSD: patch-cf,v 1.1 1999/03/07 19:40:01 kim Exp $
+
+--- sbr/m_getfld.c.orig Fri Jul 31 18:48:37 1998
++++ sbr/m_getfld.c Sun Mar 7 14:33:11 1999
+@@ -259,7 +259,7 @@
+ bp = sp = (unsigned char *) iob->_ptr - 1;
+ j = (cnt = iob->_cnt+1) < i ? cnt : i;
+ #endif
+- while ((c = *bp++) != ':' && c != '\n' && --j >= 0)
++ while (--j >= 0 && (c = *bp++) != ':' && c != '\n')
+ *cp++ = c;
+
+ j = bp - sp;
+@@ -538,7 +538,7 @@
+ ;
+ #else /* RPATHS */
+ cp = unixbuf;
+- while ((c = getc (iob)) != '\n')
++ while ((c = getc (iob)) != '\n' && cp - unixbuf < BUFSIZ - 1)
+ *cp++ = c;
+ *cp = 0;
+ #endif /* RPATHS */
+@@ -639,7 +639,7 @@
+ break;
+ #else /* RPATHS */
+ cp = unixbuf;
+- while ((c = getc (iob)) != '\n' && c >= 0)
++ while ((c = getc (iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1)
+ *cp++ = c;
+ *cp = 0;
+ #endif /* RPATHS */