diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-04-25 23:22:22 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-04-25 23:22:22 +0000 |
commit | 28bc390f3aab1f475d1f44f9e0476acd32e923f8 (patch) | |
tree | 0e9c9f6afbbefd1ad11100511190d79cd27c35fc /src | |
parent | 6cbf14f9b87bfc6608caf12f4f8105ef717477c8 (diff) | |
download | gnunet-28bc390f3aab1f475d1f44f9e0476acd32e923f8.tar.gz gnunet-28bc390f3aab1f475d1f44f9e0476acd32e923f8.zip |
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 ...
Diffstat (limited to 'src')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 11 |
1 files changed, 6 insertions, 5 deletions
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, | |||
462 | /* replace '{}' with service name */ | 462 | /* replace '{}' with service name */ |
463 | while (NULL != (optpos = strstr (options, "{}"))) | 463 | while (NULL != (optpos = strstr (options, "{}"))) |
464 | { | 464 | { |
465 | optpos[0] = '%'; | 465 | char *new_options; |
466 | optpos[1] = 's'; | 466 | /* terminate string at opening parenthesis */ |
467 | GNUNET_asprintf (&optpos, options, sl->name); | 467 | *optpos = 0; |
468 | GNUNET_free (options); | 468 | GNUNET_asprintf (&new_options, "%s%s%s", options, sl->name, optpos + 2); |
469 | options = optpos; | 469 | GNUNET_free (options); |
470 | options = new_options; | ||
470 | } | 471 | } |
471 | /* replace '$PATH' with value associated with "PATH" */ | 472 | /* replace '$PATH' with value associated with "PATH" */ |
472 | while (NULL != (optpos = strstr (options, "$"))) | 473 | while (NULL != (optpos = strstr (options, "$"))) |