From f2587b2d0c66569a439cf2f0b356b38de553b85f Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 30 May 2022 13:04:24 +0000 Subject: [PATCH] Check if args_strtonum argument is NULL or not a string, from Anindya Mukherjee. --- usr.bin/tmux/arguments.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c index 8b1f9c60786..09f933cb7c1 100644 --- a/usr.bin/tmux/arguments.c +++ b/usr.bin/tmux/arguments.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arguments.c,v 1.53 2022/03/03 08:24:12 nicm Exp $ */ +/* $OpenBSD: arguments.c,v 1.54 2022/05/30 13:04:24 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -831,6 +831,12 @@ args_strtonum(struct args *args, u_char flag, long long minval, return (0); } value = TAILQ_LAST(&entry->values, args_values); + if (value == NULL || + value->type != ARGS_STRING || + value->string == NULL) { + *cause = xstrdup("missing"); + return (0); + } ll = strtonum(value->string, minval, maxval, &errstr); if (errstr != NULL) { -- 2.20.1