On Tue, Mar 09, 2010 at 02:51:18PM +0100, Roman Rakus wrote: > > The bash segfaults on the line `while (val = > glob_matches[local_index++])', because glob_matches is pointer to > NULL. I have add the check for this null. But this is most likely > not the right patch. > RR
> diff -up bash-4.1/bashline.c.crash bash-4.1/bashline.c > --- bash-4.1/bashline.c.crash 2010-03-09 14:26:06.000000000 +0100 > +++ bash-4.1/bashline.c 2010-03-09 14:46:10.000000000 +0100 > @@ -1700,7 +1700,8 @@ globword: > return ((char *)NULL); > } > > - while (val = glob_matches[local_index++]) > + /* make sure glob_matches is not NULL */ > + while (glob_matches && (val = glob_matches[local_index++])) > { > if (executable_or_directory (val)) > { Maybe something like: --- bashline.c +++ bashline.c 2010-03-09 14:11:27.612626475 +0000 @@ -1700,6 +1700,13 @@ globword: return ((char *)NULL); } + if (GLOB_FAILED (glob_matches) || glob_matches == 0) + { + glob_ignore_case = old_glob_ignore_case; + glob_matches = (char **)NULL; + return ((char *)NULL); + } + while (val = glob_matches[local_index++]) { if (executable_or_directory (val)) as this also include the check found for (state == 0) case a few lines above the affected line? Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr