Module Name:    src
Committed By:   christos
Date:           Mon Jan 18 19:17:42 UTC 2010

Modified Files:
        src/lib/libedit: filecomplete.c

Log Message:
PR/42637: Joachim Kuebart: Shell tab completion crashes due to libedit stack
smashing


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/filecomplete.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/filecomplete.c
diff -u src/lib/libedit/filecomplete.c:1.17 src/lib/libedit/filecomplete.c:1.18
--- src/lib/libedit/filecomplete.c:1.17	Wed Dec 30 17:37:40 2009
+++ src/lib/libedit/filecomplete.c	Mon Jan 18 14:17:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: filecomplete.c,v 1.17 2009/12/30 22:37:40 christos Exp $	*/
+/*	$NetBSD: filecomplete.c,v 1.18 2010/01/18 19:17:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.17 2009/12/30 22:37:40 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.18 2010/01/18 19:17:42 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -419,9 +419,9 @@
 
 	len = li->cursor - ctemp;
 #if defined(__SSP__) || defined(__SSP_ALL__)
-	temp = malloc(len + 1);
+	temp = malloc(sizeof(*temp) * (len + 1));
 #else
-	temp = alloca(len + 1);
+	temp = alloca(sizeof(*temp) * (len + 1));
 #endif
 	(void)Strncpy(temp, ctemp, len);
 	temp[len] = '\0';

Reply via email to