summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-perl/SpeedyCGI/files/SpeedyCGI-2.22-empty-param.patch')
-rw-r--r--dev-perl/SpeedyCGI/files/SpeedyCGI-2.22-empty-param.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/dev-perl/SpeedyCGI/files/SpeedyCGI-2.22-empty-param.patch b/dev-perl/SpeedyCGI/files/SpeedyCGI-2.22-empty-param.patch
new file mode 100644
index 000000000000..0b9b7fa3c56d
--- /dev/null
+++ b/dev-perl/SpeedyCGI/files/SpeedyCGI-2.22-empty-param.patch
@@ -0,0 +1,40 @@
+Author: Niko Tyni <ntyni@iki.fi>
+Description: Allow empty strings as command-line parameters
+--- a/src/speedy_frontend.c
++++ b/src/speedy_frontend.c
+@@ -535,7 +535,26 @@
+ ADD_STRING(b, s, l);
+ }
+ }
++ /* Terminate with zero-length string */
++ ADDCHAR(b, 0);
++}
++
++/* Copy a block of strings into the buffer, including empty strings */
++static void add_strings_with_empty(register SpeedyBuf *b, register const char * const * p)
++{
++ int l;
++ register const char *s;
+
++ /* Add strings in p array */
++ for (; (s = *p); ++p) {
++ if ((l = strlen(s))) {
++ ADD_STRING(b, s, l);
++ } else {
++ /* add a 1-byte long string containing just '\0' */
++ l = 1;
++ ADD_STRING(b, s, l);
++ }
++ }
+ /* Terminate with zero-length string */
+ ADDCHAR(b, 0);
+ }
+@@ -560,7 +579,7 @@
+
+ /* Add env and argv */
+ add_strings(sb, envp);
+- add_strings(sb, scr_argv+1);
++ add_strings_with_empty(sb, scr_argv+1);
+
+ /* Put script filename into buffer */
+ add_string(sb, script_fname, strlen(script_fname));