gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37079 - gnunet/src/arm


From: gnunet
Subject: [GNUnet-SVN] r37079 - gnunet/src/arm
Date: Tue, 26 Apr 2016 01:22:22 +0200

Author: dold
Date: 2016-04-26 01:22:22 +0200 (Tue, 26 Apr 2016)
New Revision: 37079

Modified:
   gnunet/src/arm/gnunet-service-arm.c
Log:
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 ...


Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2016-04-25 22:28:16 UTC (rev 37078)
+++ gnunet/src/arm/gnunet-service-arm.c 2016-04-25 23:22:22 UTC (rev 37079)
@@ -462,11 +462,12 @@
          /* 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, "$")))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]