Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit Off by one in allocation could cause buffer over...



details:   https://anonhg.NetBSD.org/src/rev/b4cd9b914d27
branches:  trunk
changeset: 771296:b4cd9b914d27
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 18 20:24:21 2011 +0000

description:
Off by one in allocation could cause buffer overflow (Kamil Dudka)

diffstat:

 lib/libedit/vi.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ab18c3201e75 -r b4cd9b914d27 lib/libedit/vi.c
--- a/lib/libedit/vi.c  Fri Nov 18 20:22:03 2011 +0000
+++ b/lib/libedit/vi.c  Fri Nov 18 20:24:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */
+/*     $NetBSD: vi.c,v 1.42 2011/11/18 20:24:21 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)vi.c       8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $");
+__RCSID("$NetBSD: vi.c,v 1.42 2011/11/18 20:24:21 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1026,7 +1026,7 @@
                close(fd);
                return CC_ERROR;
        }
-       line = el_malloc(len * sizeof(*line));
+       line = el_malloc(len * sizeof(*line) + 1);
        if (line == NULL) {
                el_free(cp);
                return CC_ERROR;



Home | Main Index | Thread Index | Old Index