Skip to content

Commit

Permalink
Fix format-security errors with swig and java and ruby (#5253)
Browse files Browse the repository at this point in the history
Can compile java and ruby mapscript extension with gcc's
-Werror=format-security option.
  • Loading branch information
Jenselme authored and tbonfort committed Feb 23, 2016
1 parent 5c2411e commit 90f00f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mapscript/mserror.i
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
char* msg = msGetErrorString(";");
int ms_errorcode = ms_error->code;
if (msg) {
snprintf(ms_message, MAX_ERROR_LEN, msg);
snprintf(ms_message, MAX_ERROR_LEN, "%s", msg);
free(msg);
}
else sprintf(ms_message, "Unknown message");
Expand Down
12 changes: 6 additions & 6 deletions mapscript/ruby/rbmodule.i
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ static void _raise_ms_exception() {

switch (errcode) {
case MS_IOERR:
rb_raise(rb_eIOError, errmsg);
rb_raise(rb_eIOError, errmsg, "%s");
break;
case MS_MEMERR:
rb_raise(rb_eNoMemError, errmsg);
rb_raise(rb_eNoMemError, errmsg, "%s");
break;
case MS_TYPEERR:
rb_raise(rb_eTypeError, errmsg);
rb_raise(rb_eTypeError, errmsg, "%s");
break;
case MS_EOFERR:
rb_raise(rb_eEOFError, errmsg);
rb_raise(rb_eEOFError, errmsg, "%s");
break;
case MS_CHILDERR:
rb_raise(MSExc_MapServerChildError, errmsg);
rb_raise(MSExc_MapServerChildError, errmsg, "%s");
break;
default:
rb_raise(MSExc_MapServerError, errmsg);
rb_raise(MSExc_MapServerError, errmsg, "%s");
break;
}

Expand Down

0 comments on commit 90f00f7

Please sign in to comment.