Sometimes variable expansions yield empty strings, and if they happen to
be a command someone wants to run like `$foo`, then hush currently
segfaults. So handle `` and $().
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
argv_expanded = expand_strvec_to_strvec(argv + command->assignment_cnt);
}
+ /* if someone gives us an empty string: ``, $(), ... */
+ if (!argv_expanded[0]) {
+ debug_leave();
+ return 0;
+ }
+
x = find_builtin(argv_expanded[0]);
#if ENABLE_HUSH_FUNCTIONS
funcp = NULL;
--- /dev/null
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
--- /dev/null
+true; ``; echo $?
+false; ``; echo $?
+true; `""`; echo $?
+false; `""`; echo $?
+true; ` `; echo $?
+false; ` `; echo $?
+
+true; $(); echo $?
+false; $(); echo $?
+true; $(""); echo $?
+false; $(""); echo $?
+true; $( ); echo $?
+false; $( ); echo $?
+
+true; exec ''; echo $?
+false; exec ''; echo $?