From ffc365bc5d1c5dee337a2869fcc728f46dd262a8 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 28 Apr 2016 16:28:38 +0000 Subject: [PATCH] If supplied format to menuq_add() is NULL, fill text with an empty string; found by Christian Neukirchen. --- menu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/menu.c b/menu.c index cb4ee7d..969b2d2 100644 --- a/menu.c +++ b/menu.c @@ -601,7 +601,10 @@ menuq_add(struct menu_q *mq, void *ctx, const char *fmt, ...) mi->ctx = ctx; va_start(ap, fmt); - (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap); + if (fmt != NULL) + (void)vsnprintf(mi->text, sizeof(mi->text), fmt, ap); + else + mi->text[0] = '\0'; va_end(ap); TAILQ_INSERT_TAIL(mq, mi, entry);