unpack.c: unpack_BER() did assume the string length is not zero.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-03-04 14:18:20 +09:00
parent 31d4bbcfea
commit bc9476e7ca
+1
View File
@@ -414,6 +414,7 @@ unpack_BER(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary,
const unsigned char *p = src;
const unsigned char *e = p + srclen;
if (srclen == 0) return 0;
for (i=1; p<e; p++,i++) {
if (n > (MRB_INT_MAX>>7)) {
mrb_raise(mrb, E_RANGE_ERROR, "BER unpacking 'w' overflow");