From owner-freebsd-ports-bugs@FreeBSD.ORG Wed May 6 14:50:03 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3119106566C for ; Wed, 6 May 2009 14:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AD8B38FC20 for ; Wed, 6 May 2009 14:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n46Eo3sG055078 for ; Wed, 6 May 2009 14:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n46Eo3ef055077; Wed, 6 May 2009 14:50:03 GMT (envelope-from gnats) Resent-Date: Wed, 6 May 2009 14:50:03 GMT Resent-Message-Id: <200905061450.n46Eo3ef055077@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitry Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC48110656EB for ; Wed, 6 May 2009 14:40:22 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id AA1EF8FC29 for ; Wed, 6 May 2009 14:40:22 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n46EeM2j049952 for ; Wed, 6 May 2009 14:40:22 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n46EeMIu049935; Wed, 6 May 2009 14:40:22 GMT (envelope-from nobody) Message-Id: <200905061440.n46EeMIu049935@www.freebsd.org> Date: Wed, 6 May 2009 14:40:22 GMT From: Dmitry To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/134271: mail/popd POP3 server dies handling messages with very long lines (>64K) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 May 2009 14:50:04 -0000 >Number: 134271 >Category: ports >Synopsis: mail/popd POP3 server dies handling messages with very long lines (>64K) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 06 14:50:03 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Dmitry >Release: FreeBSD 7.2 >Organization: home >Environment: FreeBSD mail.mcm.ru 7.2-STABLE FreeBSD 7.2-STABLE #0: Mon May 4 18:46:34 MSD 2009 root@mail.mcm.ru:/var/tmp/obj/usr/src/sys/MCM i386 >Description: mail/popd POP3 server makes assignment to NULL pointer if the length of the email line exceeds 65535 bytes. Attached patch solves this problem. It also hides annoying messages. >How-To-Repeat: >Fix: Patch attached with submission follows: --- lib/mbox_mbf.c.orig 2003-03-05 10:33:12.000000000 +0300 +++ lib/mbox_mbf.c 2009-05-06 18:21:18.000000000 +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') { --- lib/private.h.orig 2009-05-06 18:17:23.000000000 +0400 +++ lib/private.h 2009-05-06 18:16:24.000000000 +0400 @@ -26,6 +26,9 @@ * $Id: private.h,v 1.1 2001/10/10 09:48:11 ianf Exp $ */ +#undef NULL +#define NULL 0 + #define TRUE 1 #define FALSE 0 #define MAXINCR 20 --- src/config.h.orig 2002-11-20 13:27:49.000000000 +0300 +++ src/config.h 2009-05-06 18:12:46.000000000 +0400 @@ -26,6 +26,7 @@ * $Id: config.h,v 1.20 2002/11/20 10:27:49 ianf Exp $ */ +#undef NULL #define NULL 0 #define TRUE 1 #define FALSE 0 >Release-Note: >Audit-Trail: >Unformatted: