commit ab4fb9c588d02859e599191218469411e7b100e5 parent b14cddecd20b960054a4431ee91b0abff7ce4c85 Author: hhvn <dev@hhvn.uk> Date: Mon, 28 Mar 2022 18:14:01 +0100 Fix segfault with NULL str in command_getopt Diffstat:
M | src/commands.c | | | 2 | +- |
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/commands.c b/src/commands.c @@ -2073,7 +2073,7 @@ command_getopt(char **str, struct CommandOpts *opts) { char *opt; if (!str || !*str || **str != '-') { - if (**str == '\\' && *((*str)+1) == '-') + if (str && *str && **str == '\\' && *((*str)+1) == '-') (*str)++; return opt_done; }