summaryrefslogtreecommitdiff
path: root/app-shells/bash/files/bash-2.05b-empty-herestring.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-shells/bash/files/bash-2.05b-empty-herestring.patch')
-rw-r--r--app-shells/bash/files/bash-2.05b-empty-herestring.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/app-shells/bash/files/bash-2.05b-empty-herestring.patch b/app-shells/bash/files/bash-2.05b-empty-herestring.patch
new file mode 100644
index 000000000000..db868c49aea7
--- /dev/null
+++ b/app-shells/bash/files/bash-2.05b-empty-herestring.patch
@@ -0,0 +1,25 @@
+###################################################################
+# Added by Tavis Ormandy <taviso@gentoo.org> 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 <<< ""
+###############################
+
+--- bash-2.05b/redir.c
++++ bash-2.05b/redir.c
+@@ -263,7 +263,7 @@
+ int herelen, n, e;
+
+ herestr = expand_string_to_string (redirectee->word, 0);
+- herelen = strlen (herestr);
++ herelen = (herestr == NULL) ? 0 : strlen (herestr);
+
+ n = write (fd, herestr, herelen);
+ if (n == herelen)
+ {