File tree 1 file changed +19
-3
lines changed 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -663,13 +663,29 @@ static PHPDBG_COMMAND(shell) /* {{{ */
663
663
/* don't allow this to loop, ever ... */
664
664
switch (param -> type ) {
665
665
case STR_PARAM : {
666
- FILE * fd = VCWD_POPEN (param -> str , "w" );
667
- if (fd ) {
666
+ FILE * fd = NULL ;
667
+ char * program = NULL ;
668
+
669
+ /* we expect an input, I hope we get one ! */
670
+ if (input && input -> start ) {
671
+ program = (char * ) input -> start ;
672
+
673
+ if (memcmp (
674
+ program , "shell" , sizeof ("shell" )- 1 ) == SUCCESS ) {
675
+ program += sizeof ("shell" )- 1 ;
676
+ } else program += sizeof ("-" )- 1 ;
677
+
678
+ while (program && isspace (* program )) {
679
+ program ++ ;
680
+ }
681
+ } else program = param -> str ;
682
+
683
+ if ((fd = VCWD_POPEN ((char * )program , "w" ))) {
668
684
/* do something perhaps ?? do we want input ?? */
669
685
fclose (fd );
670
686
} else {
671
687
phpdbg_error (
672
- "Failed to execute %s" , param -> str );
688
+ "Failed to execute %s" , program );
673
689
}
674
690
} break ;
675
691
You can’t perform that action at this time.
0 commit comments