From b28fd6720f782f955c8dc63381d64c6010670791 Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 28 Apr 2016 16:28:38 +0000 Subject: If supplied format to menuq_add() is NULL, fill text with an empty string; found by Christian Neukirchen. --- menu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index 6fd30b3..4a63a3c 100644 --- a/menu.c +++ b/menu.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.89 2015/11/11 14:22:01 okan Exp $ + * $OpenBSD: menu.c,v 1.90 2016/04/28 16:28:38 okan Exp $ */ #include @@ -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); -- cgit v1.2.3-2-gb3c3