Created
April 3, 2013 04:59
-
-
Save cwgem/5298556 to your computer and use it in GitHub Desktop.
Example of hardcoded iteration limit of positional parameters to single digit values in bash source code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Return the word list that corresponds to `$*'. */ | |
| WORD_LIST * | |
| list_rest_of_args () | |
| { | |
| register WORD_LIST *list, *args; | |
| int i; | |
| /* Break out of the loop as soon as one of the dollar variables is null. */ | |
| for (i = 1, list = (WORD_LIST *)NULL; i < 10 && dollar_vars[i]; i++) | |
| list = make_word_list (make_bare_word (dollar_vars[i]), list); | |
| for (args = rest_of_args; args; args = args->next) | |
| list = make_word_list (make_bare_word (args->word->word), list); | |
| return (REVERSE_LIST (list, WORD_LIST *)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment