Choices' index values may be out of range while still encoded in the fixed
length bit-field. This bug may cause access to undefined types (NULL
pointers) and thus crashes (Reported by Zhongling Wen).
This patch also adds checking of decode flag when decoding SEQUENCEs.
Signed-off-by: Jing Min Zhao <zhaojingmin@vivecode.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
                        CHECK_BOUND(bs, 2);
                        len = get_len(bs);
                        CHECK_BOUND(bs, len);
-                       if (!base) {
+                       if (!base || !(son->attr & DECODE)) {
                                PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
                                      " ", son->name);
                                bs->cur += len;
        } else {
                ext = 0;
                type = get_bits(bs, f->sz);
+               if (type >= f->lb)
+                       return H323_ERROR_RANGE;
        }
 
        /* Write Type */