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/1325d967fd0c
branches:  trunk
changeset: 448941:1325d967fd0c
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 94d6bf4d6857 -r 1325d967fd0c 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