aboutsummaryrefslogtreecommitdiffstats
path: root/gpgme/w32-io.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gpgme/w32-io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c
index 89e0dd3a..de7e6704 100644
--- a/gpgme/w32-io.c
+++ b/gpgme/w32-io.c
@@ -770,15 +770,19 @@ build_commandline ( char **argv )
/* FIXME: we have to quote some things because under Windows the
* program parses the commandline and does some unquoting */
for (i=0; argv[i]; i++)
- n += strlen (argv[i]) + 1;
+ n += strlen (argv[i]) + 2 + 1; /* 2 extra bytes for possible quoting */
buf = p = xtrymalloc (n);
if ( !buf )
return NULL;
*buf = 0;
if ( argv[0] )
p = stpcpy (p, argv[0]);
- for (i = 1; argv[i]; i++)
- p = stpcpy (stpcpy (p, " "), argv[i]);
+ for (i = 1; argv[i]; i++) {
+ if (!*argv[i])
+ p = stpcpy (p, " \"\"");
+ else
+ p = stpcpy (stpcpy (p, " "), argv[i]);
+ }
return buf;
}