Fix potential buffer overflow

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 53090f7650)
r14.0.x
Slávek Banko 9 years ago
parent 1156506d26
commit ae5ba4db11

@ -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