зеркало из https://github.com/github/ruby.git
Don't read past the end of the Ruby string
Ruby strings don't always have a null terminator, so we can't use it as a regular C string. By reading only the first len bytes of the Ruby string, we won't read past the end of the Ruby string.
This commit is contained in:
Родитель
a137874e67
Коммит
21ad4075a7
2
gc.c
2
gc.c
|
@ -11667,7 +11667,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_STRING: {
|
case T_STRING: {
|
||||||
APPENDF((BUFF_ARGS, "%s", RSTRING_PTR(obj)));
|
APPENDF((BUFF_ARGS, "%.*s", (int)RSTRING_LEN(obj), RSTRING_PTR(obj)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case T_MOVED: {
|
case T_MOVED: {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче