Skip to content
Permalink
Browse files

Fix format-security errors with swig and java and ruby (#5253)

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 90f00f77631ee42de9a2efa92807f5ee3254c662
Showing with 7 additions and 7 deletions.
  1. +1 −1 mapscript/mserror.i
  2. +6 −6 mapscript/ruby/rbmodule.i
@@ -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");
@@ -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;
}

0 comments on commit 90f00f7

Please sign in to comment.
You can’t perform that action at this time.