From 28bc390f3aab1f475d1f44f9e0476acd32e923f8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 25 Apr 2016 23:22:22 +0000 Subject: Remove format string abuse with sane code. With the old code, parts of the config file were interpreted as format string, always a bad idea ... --- src/arm/gnunet-service-arm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 28d448f75..189e1872c 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -462,11 +462,12 @@ start_process (struct ServiceList *sl, /* replace '{}' with service name */ while (NULL != (optpos = strstr (options, "{}"))) { - optpos[0] = '%'; - optpos[1] = 's'; - GNUNET_asprintf (&optpos, options, sl->name); - GNUNET_free (options); - options = optpos; + char *new_options; + /* terminate string at opening parenthesis */ + *optpos = 0; + GNUNET_asprintf (&new_options, "%s%s%s", options, sl->name, optpos + 2); + GNUNET_free (options); + options = new_options; } /* replace '$PATH' with value associated with "PATH" */ while (NULL != (optpos = strstr (options, "$"))) -- cgit v1.2.3