diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-06-10 11:30:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-11 13:58:20 -0700 |
commit | 2d7b02726e8501d5e45d3648768a3d2485e70f91 (patch) | |
tree | b65a06c381f71c6275603a68eb3fa0b90624634b | |
parent | 2b59765da3882f1564e5ae034a35c0ce35441108 (diff) | |
download | subsurface-2d7b02726e8501d5e45d3648768a3d2485e70f91.tar.gz |
Have explicit "%s" format strings in printf style statements
Not having a format string that explicitly references the arguments is
considered a potential security issue in code.
This gets rid of a compiler warning that turned into an error on Fedora 21.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | planner.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -532,12 +532,12 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool translate("gettextFromC", "%s<br>Subsurface dive plan<br>based on GFlow = %d and GFhigh = %d<br><br>"), show_disclaimer ? disclaimer : empty, diveplan->gflow, diveplan->gfhigh); if (!plan_verbatim) { - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>")); if (plan_display_runtime) - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " <th>runtime</th>")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " <th>runtime</th>")); if (plan_display_duration) - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " <th>duration</th>")); - len += snprintf(buffer + len, sizeof(buffer) - len, " <th align=left>gas</th></tr><tbody align=right>"); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " <th>duration</th>")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC"," <th align=left>gas</th></tr><tbody align=right>")); } do { struct gasmix gasmix, newgasmix; @@ -619,7 +619,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool lastdepth = dp->depth; } while ((dp = nextdp) != NULL); len = strlen(buffer); - snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "</tbody></table><br>Gas consumption:<br>")); + snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "</tbody></table><br>Gas consumption:<br>")); for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) { double volume; const char *unit; |