There's a buffer overflow in ENTTEC DMX Data RLE, leading to crashes and
potential code execution.
From me: ep_allocate our buffers.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35318
f5534014-38df-0310-8fa8-
9805f1628bb7
- static guint8 dmx_data[512];
- static guint16 dmx_data_offset[513]; /* 1 extra for last offset */
+ guint8 *dmx_data = ep_alloc(512 * sizeof(guint8));
+ guint16 *dmx_data_offset = ep_alloc(513 * sizeof(guint16)); /* 1 extra for last offset */
emem_strbuf_t *dmx_epstr;
proto_tree *hi,*si;
emem_strbuf_t *dmx_epstr;
proto_tree *hi,*si;
length = 512;
if (type == ENTTEC_DATA_TYPE_RLE) {
length = 512;
if (type == ENTTEC_DATA_TYPE_RLE) {
- /* uncompres the DMX data */
+ /* uncompress the DMX data */
+ while (ci < length && ui < 512) {
v = tvb_get_guint8(tvb, offset+ci);
if (v == 0xFE) {
ci++;
v = tvb_get_guint8(tvb, offset+ci);
if (v == 0xFE) {
ci++;
ci++;
v = tvb_get_guint8(tvb, offset+ci);
ci++;
ci++;
v = tvb_get_guint8(tvb, offset+ci);
ci++;
- for (i=0;i < count;i++) {
+ for (i=0;i < count && ui < 512;i++) {
dmx_data[ui] = v;
dmx_data_offset[ui] = ci-3;
ui++;
dmx_data[ui] = v;
dmx_data_offset[ui] = ci-3;
ui++;