summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/object.c b/object.c
index b95b097b6a..1a81fd7d80 100644
--- a/object.c
+++ b/object.c
@@ -1567,6 +1567,9 @@ str_to_id(str)
if (!RSTRING(str)->ptr || RSTRING(str)->len == 0) {
rb_raise(rb_eArgError, "empty symbol string");
}
+ if (RSTRING(str)->len != strlen(RSTRING(str)->ptr)) {
+ rb_raise(rb_eArgError, "Symbols should not contain NUL (\\0)");
+ }
return rb_intern(RSTRING(str)->ptr);
}