Skip to content

Commit

Permalink
fix -Wformat-security format string warning
Browse files Browse the repository at this point in the history
  • Loading branch information
evanbiederstedt committed Feb 27, 2024
1 parent 2ff1fee commit 1dba093
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.1.3] - 2024 February 27
* Fixed Makevars file
* Fix "format string is not a string literal" error, '-Wformat-security' warning

## [1.1.2] - 2023 September 3
* README changes, documentation changes

Expand Down
9 changes: 8 additions & 1 deletion src/rigraph/rinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@ SEXP R_igraph_handle_safe_eval_result(SEXP result) {
SEXP condition_message = PROTECT(Rf_install("conditionMessage"));
SEXP condition_message_call = PROTECT(Rf_lang2(condition_message, result));
SEXP evaluated_condition_message = PROTECT(Rf_eval(condition_message_call, R_GlobalEnv));
error(CHAR(STRING_ELT(evaluated_condition_message, 0)));
// fix for 'format string is not a string literal' flag warning
const char *message_char;
message_char = CHAR(STRING_ELT(evaluated_condition_message, 0));
if (message_char != NULL) {
error(message_char);
} else {
error("Something screwed up in R_igraph_handle_safe_eval_result()");
}
UNPROTECT(3);
return R_NilValue;

Expand Down

0 comments on commit 1dba093

Please sign in to comment.