Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit PR/53981: Jonathan Perkins: history_list should ...



details:   https://anonhg.NetBSD.org/src/rev/86b810656431
branches:  trunk
changeset: 996957:86b810656431
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 14 20:09:12 2019 +0000

description:
PR/53981: Jonathan Perkins: history_list should null-terminate

diffstat:

 lib/libedit/readline.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r c67b384e0f9e -r 86b810656431 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Thu Feb 14 17:08:54 2019 +0000
+++ b/lib/libedit/readline.c    Thu Feb 14 20:09:12 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.149 2019/01/10 18:41:56 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.149 2019/01/10 18:41:56 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.150 2019/02/14 20:09:12 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1590,7 +1590,7 @@
                return NULL;
 
        if ((nlp = el_realloc(_history_listp,
-           (size_t)history_length * sizeof(*nlp))) == NULL)
+           ((size_t)history_length + 1) * sizeof(*nlp))) == NULL)
                return NULL;
        _history_listp = nlp;
 
@@ -1607,6 +1607,7 @@
                if (i++ == history_length)
                        abort();
        } while (history(h, &ev, H_PREV) == 0);
+       _history_listp[i] = NULL;
        return _history_listp;
 }
 



Home | Main Index | Thread Index | Old Index