308a3c6425ec8ce1c172654b0812fce87eb82740 — Simon Ser 30 days ago 5a5f1ad
shell/task/word: handle empty names in parameter_get_value
1 files changed, 3 insertions(+), 2 deletions(-)

M shell/task/word.c
M shell/task/word.c => shell/task/word.c +3 -2
@@ 95,7 95,8 @@ return job_wait_process(process);
  }
  
- static const char *parameter_get_value(struct mrsh_state *state, char *name) {
+ static const char *parameter_get_value(struct mrsh_state *state,
+ 		const char *name) {
  	static char value[16];
  	char *end;
  	long lvalue = strtol(name, &end, 10);


@@ 128,7 129,7 @@ }
  		/* Standard is unclear on what to do in this case, mimic dash */
  		return "";
- 	} else if (end[0] == '\0') {
+ 	} else if (end[0] == '\0' && end != name) {
  		if (lvalue >= state->frame->argc) {
  			return NULL;
  		}