is_binary_xml: don't explode on too-short inputs

This commit is contained in:
William Toohey 2021-05-03 22:32:27 +10:00
parent 3cbc3179a8
commit 5707a6bf8b

View File

@ -68,6 +68,9 @@ class KBinXML():
@staticmethod
def is_binary_xml(input):
if len(input) < 2:
return False
nodeBuf = ByteBuffer(input)
return (nodeBuf.get_u8() == SIGNATURE and
nodeBuf.get_u8() in (SIG_COMPRESSED, SIG_UNCOMPRESSED))