check Ruby strings for embedded null bytes
The RGSS doesn't do it. But doing it shouldn't be a problem, as it's the correct way. If a game is broken by this commit (unlikely), then the game needs to be fixed as silent truncation is highly unlikely to be wanted.
This commit is contained in:
parent
a365a7a754
commit
29dfda0011
|
@ -189,7 +189,7 @@ rb_get_args(int argc, VALUE *argv, const char *format, ...)
|
|||
if (!RB_TYPE_P(tmp, RUBY_T_STRING))
|
||||
rb_raise(rb_eTypeError, "Argument %d: Expected string", argI);
|
||||
|
||||
*s = RSTRING_PTR(tmp);
|
||||
*s = StringValueCStr(tmp);
|
||||
++argI;
|
||||
|
||||
break;
|
||||
|
|
|
@ -32,7 +32,7 @@ DEF_TYPE(Bitmap);
|
|||
static const char *objAsStringPtr(VALUE obj)
|
||||
{
|
||||
VALUE str = rb_obj_as_string(obj);
|
||||
return RSTRING_PTR(str);
|
||||
return StringValueCStr(str);
|
||||
}
|
||||
|
||||
void bitmapInitProps(Bitmap *b, VALUE self)
|
||||
|
|
Loading…
Reference in New Issue