From 5439fdddbda55fffc2348d840a67d8fa35914b2d Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 23 Jul 2019 10:18:52 +0000 Subject: PR/54399: Sören Tempel: Uninitialized memory access in libedit history. Initialize the buffer using calloc. While here change all malloc(a * sizeof(b)) to calloc(a, sizeof(b)). XXX: should fix realloc similarly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/libedit/keymacro.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libedit/keymacro.c') diff --git a/lib/libedit/keymacro.c b/lib/libedit/keymacro.c index 13d208930e6..cef24a1752e 100644 --- a/lib/libedit/keymacro.c +++ b/lib/libedit/keymacro.c @@ -1,4 +1,4 @@ -/* $NetBSD: keymacro.c,v 1.23 2016/05/24 15:00:45 christos Exp $ */ +/* $NetBSD: keymacro.c,v 1.24 2019/07/23 10:18:52 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: keymacro.c,v 1.23 2016/05/24 15:00:45 christos Exp $"); +__RCSID("$NetBSD: keymacro.c,v 1.24 2019/07/23 10:18:52 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -105,7 +105,7 @@ libedit_private int keymacro_init(EditLine *el) { - el->el_keymacro.buf = el_malloc(KEY_BUFSIZ * + el->el_keymacro.buf = el_calloc(KEY_BUFSIZ, sizeof(*el->el_keymacro.buf)); if (el->el_keymacro.buf == NULL) return -1; -- cgit