--- /dev/null
+diff -ur dialog-1.3-20160209.orig/argv.c dialog-1.3-20160209/argv.c
+--- dialog-1.3-20160209.orig/argv.c 2015-05-13 00:34:39.000000000 +0000
++++ dialog-1.3-20160209/argv.c 2016-02-11 10:41:08.705828223 +0000
+@@ -55,12 +55,18 @@
+ ++count;
+ inparm = TRUE;
+ }
+- } else if (!quoted && isspace(UCH(blob[n]))) {
+- if (inparm) {
++ } else if (blob[n] == '\\') {
++ if (quoted && !isspace(UCH(blob[n + 1]))) {
+ if (pass) {
+- *param++ = '\0';
++ *param++ = blob[n];
++ *param++ = blob[n + 1];
+ }
+- inparm = FALSE;
++ }
++ ++n;
++ } else if (!quoted && isspace(UCH(blob[n]))) {
++ inparm = FALSE;
++ if (pass) {
++ *param++ = '\0';
+ }
+ } else {
+ if (!inparm) {
+@@ -69,10 +75,6 @@
+ ++count;
+ inparm = TRUE;
+ }
+- if (blob[n] == '\\') {
+- if (++n == length)
+- break; /* The string is terminated by a backslash */
+- }
+ if (pass) {
+ *param++ = blob[n];
+ }
+diff -ur dialog-1.3-20160209.orig/dialog.c dialog-1.3-20160209/dialog.c
+--- dialog-1.3-20160209.orig/dialog.c 2016-02-09 00:05:39.000000000 +0000
++++ dialog-1.3-20160209/dialog.c 2016-02-11 10:41:08.707828223 +0000
+@@ -421,58 +421,49 @@
+ blob[length] = '\0';
+
+ list = dlg_string_to_argv(blob);
+- added = dlg_count_argv(list);
+- if (added > 2) {
+- /* *argcp arguments before the expansion of --file
+- - 2 for the removal of '--file <filepath>'
+- + added for the arguments contained in <filepath>
+- + 1 for the terminating NULL pointer */
+- size_t need = (size_t) (*argcp + added - 1);
+- if (doalloc) {
+- *argvp = dlg_realloc(char *, need, *argvp);
+- assert_ptr(*argvp, "unescape_argv");
+- } else {
+- char **newp = dlg_malloc(char *, need);
+- assert_ptr(newp, "unescape_argv");
+- for (n = 0; n < *argcp; ++n) {
+- newp[n] = (*argvp)[n];
++ if ((added = dlg_count_argv(list)) != 0) {
++ if (added > 2) {
++ size_t need = (size_t) (*argcp + added + 1);
++ if (doalloc) {
++ *argvp = dlg_realloc(char *, need, *argvp);
++ assert_ptr(*argvp, "unescape_argv");
++ } else {
++ char **newp = dlg_malloc(char *, need);
++ assert_ptr(newp, "unescape_argv");
++ for (n = 0; n < *argcp; ++n) {
++ newp[n] = (*argvp)[n];
++ }
++ *argvp = newp;
++ doalloc = TRUE;
+ }
+- /* The new array is not NULL-terminated yet. */
+- *argvp = newp;
+- doalloc = TRUE;
++ dialog_opts = dlg_realloc(bool, need, dialog_opts);
++ assert_ptr(dialog_opts, "unescape_argv");
+ }
+- dialog_opts = dlg_realloc(bool, need, dialog_opts);
+- assert_ptr(dialog_opts, "unescape_argv");
+-
+- /* Shift the arguments after '--file <filepath>'
+- right by (added - 2) positions */
+- for (n = *argcp - 1; n >= j + 2; --n) {
+- (*argvp)[n + added - 2] = (*argvp)[n];
+- dialog_opts[n + added - 2] = dialog_opts[n];
++ if (added > 2) {
++ for (n = *argcp; n >= j + 2; --n) {
++ (*argvp)[n + added - 2] = (*argvp)[n];
++ dialog_opts[n + added - 2] = dialog_opts[n];
++ }
++ } else if (added == 1) {
++ for (n = j; n < *argcp; ++n) {
++ (*argvp)[n] = (*argvp)[n + 1];
++ dialog_opts[n] = dialog_opts[n + 1];
++ }
+ }
+- } else if (added < 2) {
+- /* 0 or 1 argument read from the included file
+- -> shift the arguments after '--file <filepath>'
+- left by (2 - added) positions */
+- for (n = j + added; n + 2 - added < *argcp; ++n) {
+- (*argvp)[n] = (*argvp)[n + 2 - added];
+- dialog_opts[n] = dialog_opts[n + 2 - added];
++ for (n = 0; n < added; ++n) {
++ (*argvp)[n + j] = list[n];
++ dialog_opts[n + j] = FALSE;
+ }
++ *argcp += added - 2;
++ free(list);
++ --j; /* force rescan */
+ }
+- /* Copy the inserted arguments to *argvp */
+- for (n = 0; n < added; ++n) {
+- (*argvp)[n + j] = list[n];
+- dialog_opts[n + j] = FALSE;
+- }
+- *argcp += added - 2;
+- (*argvp)[*argcp] = 0; /* Write the NULL terminator */
+- free(list); /* No-op if 'list' is NULL */
+- /* Force rescan starting from the first inserted argument */
+- --j;
+- continue;
+ } else {
+ dlg_exiterr("Cannot open --file %s", filename);
+ }
++ (*argvp)[*argcp] = 0;
++ ++j;
++ continue;
+ } else {
+ dlg_exiterr("No value given for --file");
+ }