Fix potential buffer overflow

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head
Slávek Banko 9 years ago
parent f4b637a92b
commit 53090f7650

@ -283,7 +283,8 @@ bool fmt_codec::getHdrHead()
bool done = false;
s8 a, b;
s8 x[2], y[2];
s8 buff[80];
const u32 buffSize = 80;
s8 buff[buffSize];
u32 count = 0;
if(!frs.readK(hdr.sig, sizeof(hdr.sig)-1)) return false;
@ -320,6 +321,9 @@ bool fmt_codec::getHdrHead()
if(!frs.readK(&a, sizeof(s8))) return false;
++count;
if (count > buffSize-1) {
return false;
}
}
buff[count] = '\0';

Loading…
Cancel
Save