diff options
author | Slávek Banko <[email protected]> | 2015-09-14 01:27:38 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2015-09-14 01:30:31 +0200 |
commit | ae5ba4db112a6398401197a4abd453cc909c71af (patch) | |
tree | 4be5c530492e3deb7fe74ecbcc4fd69a6e8467a2 /kernel | |
parent | 1156506d26e51e144d8eef32aec15ec52a832029 (diff) | |
download | libksquirrel-ae5ba4db112a6398401197a4abd453cc909c71af.tar.gz libksquirrel-ae5ba4db112a6398401197a4abd453cc909c71af.zip |
Fix potential buffer overflow
Signed-off-by: Slávek Banko <[email protected]>
(cherry picked from commit 53090f76505d2109d86175f6d002b69996d90eea)
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kls_hdr/fmt_codec_hdr.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/kls_hdr/fmt_codec_hdr.cpp b/kernel/kls_hdr/fmt_codec_hdr.cpp index 9819504..33af0a0 100644 --- a/kernel/kls_hdr/fmt_codec_hdr.cpp +++ b/kernel/kls_hdr/fmt_codec_hdr.cpp @@ -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'; |