diff options
| author | christos <christos@NetBSD.org> | 2019-07-23 10:18:52 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2019-07-23 10:18:52 +0000 |
| commit | 5439fdddbda55fffc2348d840a67d8fa35914b2d (patch) | |
| tree | e64ac73f44bc4cf138a93e6faa0545d9d6508e59 /lib/libedit/parse.c | |
| parent | d0d4388f4c0dff4fc2533cdd4920677859e0b914 (diff) | |
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.
Diffstat (limited to 'lib/libedit/parse.c')
| -rw-r--r-- | lib/libedit/parse.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 75c611e85e1..2620f41eb1c 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.41 2018/11/29 03:10:20 christos Exp $ */ +/* $NetBSD: parse.c,v 1.42 2019/07/23 10:18:52 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: parse.c,v 1.41 2018/11/29 03:10:20 christos Exp $"); +__RCSID("$NetBSD: parse.c,v 1.42 2019/07/23 10:18:52 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -112,7 +112,7 @@ el_wparse(EditLine *el, int argc, const wchar_t *argv[]) if (ptr == argv[0]) return 0; l = (size_t)(ptr - argv[0]); - tprog = el_malloc((l + 1) * sizeof(*tprog)); + tprog = el_calloc(l + 1, sizeof(*tprog)); if (tprog == NULL) return 0; (void) wcsncpy(tprog, argv[0], l); |
