################################################################### # Added by Tavis Ormandy 01/05/2003 # Reproduce with # # $ xargs <<< ${EMTPY_VARIABLE} # Segmentation fault. # # note: bash will still give you a "\n" with this patch, but this is # standard behaviour, if you need proof: # # $ wc -l <<< "" ############################### diff -u bash-2.05b.orig/redir.c bash-2.05b/redir.c --- bash-2.05b.orig/redir.c 2002-03-12 20:27:38.000000000 +0000 +++ bash-2.05b/redir.c 2003-05-01 13:04:07.000000000 +0100 @@ -263,8 +263,10 @@ int herelen, n, e; herestr = expand_string_to_string (redirectee->word, 0); - herelen = strlen (herestr); + /* verify string wasnt empty */ + herelen = (herestr == NULL) ? 0 : strlen (herestr); + n = write (fd, herestr, herelen); if (n == herelen) {