Fix segfault in DTSC library when walking out of an incomplete object.

This commit is contained in:
Thulinma 2016-05-17 10:17:32 +02:00
parent 5704bb6595
commit 081f024e2c

View file

@ -278,7 +278,7 @@ namespace DTSC {
if (p[0] == DTSC_OBJ || p[0] == DTSC_CON) { if (p[0] == DTSC_OBJ || p[0] == DTSC_CON) {
p++; p++;
//object, scan contents //object, scan contents
while (p[0] + p[1] != 0 && p < max) { //while not encountering 0x0000 (we assume 0x0000EE) while (p < max && p[0] + p[1] != 0) { //while not encountering 0x0000 (we assume 0x0000EE)
if (p + 2 >= max) { if (p + 2 >= max) {
return 0;//out of packet! return 0;//out of packet!
} }
@ -294,7 +294,7 @@ namespace DTSC {
if (p[0] == DTSC_ARR) { if (p[0] == DTSC_ARR) {
p++; p++;
//array, scan contents //array, scan contents
while (p[0] + p[1] != 0 && p < max) { //while not encountering 0x0000 (we assume 0x0000EE) while (p < max && p[0] + p[1] != 0) { //while not encountering 0x0000 (we assume 0x0000EE)
//search through contents... //search through contents...
p = skipDTSC(p, max); p = skipDTSC(p, max);
if (!p) { if (!p) {