Subject: Re: lib/30552: small bug in libedit might cause abnormal program
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: =?ISO-8859-1?Q?Bj=F6rn_K=F6nig?= <bkoenig@cs.tu-berlin.de>
List: netbsd-bugs
Date: 06/21/2005 12:16:03
The following reply was made to PR lib/30552; it has been noted by GNATS.

From: =?ISO-8859-1?Q?Bj=F6rn_K=F6nig?= <bkoenig@cs.tu-berlin.de>
To: Christos Zoulas <christos@zoulas.com>
Cc: gnats-bugs@netbsd.org, lib-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/30552: small bug in libedit might cause abnormal program
 termination
Date: Tue, 21 Jun 2005 13:42:40 +0200

 This is a multi-part message in MIME format.
 --------------060209080002060908040400
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 8bit
 
 I'm sorry. Try this one instead of my previously sent patch.
 
 Björn
 
 --------------060209080002060908040400
 Content-Type: text/x-patch;
  name="map.c.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="map.c.diff"
 
 --- map.c.orig	Thu Aug  7 18:44:32 2003
 +++ map.c	Tue Jun 21 13:39:24 2005
 @@ -915,11 +915,20 @@
  	el->el_map.vic = el_map_vi_command;
  	el->el_map.vii = el_map_vi_insert;
  	el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) *
 -	    EL_NUM_FCNS);
 +	    (EL_NUM_FCNS + 1));
  	if (el->el_map.help == NULL)
  		return (-1);
 +	/* set sizeof(el_bindings_t) more bytes to "1" ... */
 +	(void) memset(el->el_map.help, 1, sizeof(el_bindings_t) * (EL_NUM_FCNS + 1));
 +	/* ... but copy only N = EL_NUM_FCNS structures */
  	(void) memcpy(el->el_map.help, help__get(),
  	    sizeof(el_bindings_t) * EL_NUM_FCNS);
 +	{
 +		el_bindings_t *p = el->el_map.help;
 +		for (;p->name;p++)
 +			printf("%s\n", p->name);
 +		printf("done\n");
 +	}
  	el->el_map.func = (el_func_t *)el_malloc(sizeof(el_func_t) *
  	    EL_NUM_FCNS);
  	if (el->el_map.func == NULL)
 
 --------------060209080002060908040400--