~emersion/mrsh

280fdf5ec59d6e66541d6b90e93ad0a3866b58ee — Casey Duncan 3 years ago df5641d
Fix crash in set builtin
1 files changed, 4 insertions(+), 1 deletions(-)

M builtin/set.c
M builtin/set.c => builtin/set.c +4 -1
@@ 193,8 193,11 @@ static int set(struct mrsh_state *state, int argc, char *argv[],
		if (init_args != NULL) {
			argv_0 = strdup(argv[i++]);
			init_args->command_file = argv_0;
		} else {
		} else if (state->frame->argv) {
			argv_0 = strdup(state->frame->argv[0]);
		} else {
			fprintf(stderr, set_usage);
			return 1;
		}
		argv_free(state->frame->argc, state->frame->argv);
		state->frame->argc = argc - i + 1;