From 1a9bcdf202f062e89bb73aa9b0bfe6e3c9b4d5d9 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Tue, 30 Mar 2021 20:15:07 +0900 Subject: Treat textlist item number as int instead of short cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838952 --- history.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'history.c') diff --git a/history.c b/history.c index f2a00b4..2ba0400 100644 --- a/history.c +++ b/history.c @@ -119,7 +119,8 @@ unshiftHist(Hist *hist, char *ptr) { HistItem *item; - if (hist == NULL || hist->list == NULL) + if (hist == NULL || hist->list == NULL || + hist->list->nitem >= HIST_LIST_MAX) return NULL; item = (HistItem *)newListItem((void *)allocStr(ptr, -1), (ListItem *)hist->list->first, NULL); @@ -137,7 +138,8 @@ pushHist(Hist *hist, char *ptr) { HistItem *item; - if (hist == NULL || hist->list == NULL) + if (hist == NULL || hist->list == NULL || + hist->list->nitem >= HIST_LIST_MAX) return NULL; item = (HistItem *)newListItem((void *)allocStr(ptr, -1), NULL, (ListItem *)hist->list->last); @@ -157,7 +159,8 @@ pushHashHist(Hist *hist, char *ptr) { HistItem *item; - if (hist == NULL || hist->list == NULL) + if (hist == NULL || hist->list == NULL || + hist->list->nitem >= HIST_LIST_MAX) return NULL; item = getHashHist(hist, ptr); if (item) { -- cgit v1.2.3