summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-05-30 13:04:25 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-05-30 13:04:25 +0000
commit6bfe31a3de2211cf8667b94346c7db7070be1b9b (patch)
tree6a8ca057bb13bc842d1930c9a1f9dbd073feeb69 /usr.bin/tmux/arguments.c
parent56d8ec12e689c94918d20853fa65d808e188b614 (diff)
Check if args_strtonum argument is NULL or not a string, from Anindya
Mukherjee.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r--usr.bin/tmux/arguments.c8
1 files changed, 7 insertions, 1 deletions
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 <nicholas.marriott@gmail.com>
@@ -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) {