From 2f8208fe7786625939fcd121b4e4289a8796786e Mon Sep 17 00:00:00 2001 From: emaste Date: Fri, 30 Jan 2015 14:22:15 +0000 Subject: Merge libedit fixes from NetBSD Add trailing NULL's to the varargs functions as required. (John Spencer) readline.c r1.106 Bounds search for reallocated index, from OpenBSD via Andreas Fett map.c 1.34 map.h 1.10 parse.c 1.27 read.c 1.71 This is a direct commit to stable/10 as these changes are included in a broader sync with NetBSD committed by bapt@ in r276881. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D1728 --- lib/libedit/parse.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/libedit/parse.c') diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 0ffe51d..1c42afe 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -252,10 +252,11 @@ parse__string(char *out, const char *in) protected int parse_cmd(EditLine *el, const char *cmd) { - el_bindings_t *b; + el_bindings_t *b = el->el_map.help; + size_t i; - for (b = el->el_map.help; b->name != NULL; b++) - if (strcmp(b->name, cmd) == 0) - return (b->func); + for (i = 0; i < el->el_map.nfunc; i++) + if (strcmp(b[i].name, cmd) == 0) + return (b[i].func); return (-1); } -- cgit v1.1