From nobody@FreeBSD.org  Fri Oct 19 23:03:56 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3D58E16A41B
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Oct 2007 23:03:56 +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 0F06413C459
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Oct 2007 23:03:56 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l9JN3dMa014785
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Oct 2007 23:03:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l9JN3d3S014784;
	Fri, 19 Oct 2007 23:03:39 GMT
	(envelope-from nobody)
Message-Id: <200710192303.l9JN3d3S014784@www.freebsd.org>
Date: Fri, 19 Oct 2007 23:03:39 GMT
From: Martin Beran <mb@tns.cz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Loading history file sometimes fails in libedit
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         117348
>Category:       kern
>Synopsis:       [libedit] Loading history file sometimes fails in libedit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 19 23:10:02 UTC 2007
>Closed-Date:    
>Last-Modified:  Mon Jan 14 04:43:43 UTC 2008
>Originator:     Martin Beran
>Release:        6.2-RELEASE-p4
>Organization:
Trusted Network Solutions, a. s.
>Environment:
FreeBSD mb.tns.cz 6.2-RELEASE-p4 FreeBSD 6.2-RELEASE-p4 #0: Sun Apr 29 22:31:25 CEST 2007     root@mb.tns.cz:/usr/obj/usr/src/sys/MB  i386

>Description:
Under some circumstances, loading history in libedit by history(H_LOAD)
causes abnormal program termination due to invalid memory access on line
693 of /usr/src/lib/libedit/history.c.
>How-To-Repeat:

>Fix:
Compile the following program with ElectricFence
#include <histedit.h>
int main(int argc, char* argv[])
{
    History* h = history_init();
    HistEvent ev;
    history(h, &ev, H_LOAD, argv[1]);
    return 0;
}
and run it with a history file 4096 bytes long containing
_HiStOrY_V2_
def0123456789abcdef0123456789abcdef0123456789abcde
followed by 63 copies of line:
0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde



>Release-Note:
>Audit-Trail:
>Unformatted:
