freebsd-ports/mail/popd/files/patch-lib__mbox_mbf.c
Philip M. Gollucci 97e4c17bf0 - Fix a null pointer exception
(asked submitted to send this patch upstream)

PR:             ports/134721
Submitted by:   Dmitry <hanabana@mail.ru>
Approved by:    maintainer timeout (ian@freislich.nom.za; 1.5 months)
2009-06-23 23:39:18 +00:00

30 lines
805 B
C

--- ./lib/mbox_mbf.c.orig 2003-03-05 02:33:12.000000000 -0500
+++ ./lib/mbox_mbf.c 2009-06-23 19:35:15.499808776 -0400
@@ -151,7 +151,10 @@
bytes -= len;
offset += len;
q[buffleft] = '\0';
- p = strchr(buffer, '\n');
+ if ((p = strchr(buffer, '\n')) == NULL) {
+ p = q + buffleft;
+ continue;
+ }
}
*p++ = '\0';
if (*line == '\0') {
@@ -382,7 +385,14 @@
len = read(mbox->fd, offset, buffleft);
bytes -= len;
offset[len] = '\0';
- p = strchr(buffer, '\n');
+ if ((p = strchr(buffer, '\n')) == NULL) {
+ p = offset + len;
+ if( (p - buffer) == 1 && buffer[0] == '.' )
+ sendline(SEND_BUF, "..");
+ else
+ sendline(SEND_BUF, "%s", buffer);
+ continue;
+ }
}
*p++ = '\0';
if (line[0] == '.' && line[1] == '\0') {