summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'random.c')
-rw-r--r--random.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/random.c b/random.c
index 82111ce69e..fed85e0a47 100644
--- a/random.c
+++ b/random.c
@@ -580,6 +580,7 @@ random_raw_seed(VALUE self, VALUE size)
{
long n = NUM2ULONG(size);
VALUE buf = rb_str_new(0, n);
+ if (n == 0) return buf;
if (fill_random_bytes(RSTRING_PTR(buf), n)) return Qnil;
return buf;
}