Skip to content

Commit

Permalink
Fixed various clang -Wformat-security warnings (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanm authored Feb 19, 2021
1 parent 2ea165e commit a6f1b6c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/H5Clog_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)

/* Write the log message and flush */
n_chars = HDstrlen(json_udata->message);
if ((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));

Expand Down
2 changes: 1 addition & 1 deletion src/H5Clog_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)

/* Write the log message and flush */
n_chars = HDstrlen(trace_udata->message);
if ((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));

Expand Down
4 changes: 2 additions & 2 deletions tools/src/h5import/h5import.c
Original file line number Diff line number Diff line change
Expand Up @@ -2536,7 +2536,7 @@ parsePathInfo(struct path_info *path, char *temp)

token = HDstrtok(temp, delimiter);
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
(void)HDfprintf(stderr, err1);
(void)HDfprintf(stderr, "%s", err1);
return (-1);
}
HDstrcpy(path->group[i++], token);
Expand All @@ -2546,7 +2546,7 @@ parsePathInfo(struct path_info *path, char *temp)
if (token == NULL)
break;
if (HDstrlen(token) >= MAX_PATH_NAME_LENGTH) {
(void)HDfprintf(stderr, err1);
(void)HDfprintf(stderr, "%s", err1);
return (-1);
}
HDstrcpy(path->group[i++], token);
Expand Down

0 comments on commit a6f1b6c

Please sign in to comment.