From 2d7b02726e8501d5e45d3648768a3d2485e70f91 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 10 Jun 2014 11:30:18 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- planner.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/planner.c b/planner.c index b682bd5cd..25fd4908b 100644 --- a/planner.c +++ b/planner.c @@ -532,12 +532,12 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool translate("gettextFromC", "%s
Subsurface dive plan
based on GFlow = %d and GFhigh = %d

"), show_disclaimer ? disclaimer : empty, diveplan->gflow, diveplan->gfhigh); if (!plan_verbatim) { - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "
depth
")); if (plan_display_runtime) - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " ")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " ")); if (plan_display_duration) - len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " ")); - len += snprintf(buffer + len, sizeof(buffer) - len, " "); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", " ")); + len += snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC"," ")); } 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", "
depthruntimeruntimedurationgas
durationgas

Gas consumption:
")); + snprintf(buffer + len, sizeof(buffer) - len, "%s", translate("gettextFromC", "
Gas consumption:
")); for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) { double volume; const char *unit; -- cgit v1.2.3-70-g09d2