fanzeyi / rpms / ncurses

Forked from rpms/ncurses 3 years ago
Clone
Blob Blame History Raw
20180414
	+ add a null-pointer check in _nc_parse_entry to handle an error when
	  a use-name is invalid syntax (report by Chung-Yi Lin).

diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c
index 2b54f45d..437f1223 100644
--- a/ncurses/tinfo/parse_entry.c
+++ b/ncurses/tinfo/parse_entry.c
@@ -543,9 +543,11 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent)
 		 * Otherwise, look for a base entry that will already
 		 * have picked up defaults via translation.
 		 */
-		for (i = 0; i < entryp->nuses; i++)
-		    if (!strchr((char *) entryp->uses[i].name, '+'))
+		for (i = 0; i < entryp->nuses; i++) {
+		    if (entryp->uses[i].name != 0
+			&& !strchr(entryp->uses[i].name, '+'))
 			has_base_entry = TRUE;
+		}
 	    }
 
 	    postprocess_termcap(&entryp->tterm, has_base_entry);