From 5707a6bf8bef25d2c59d48bf6ba7a2a8fd4c2007 Mon Sep 17 00:00:00 2001 From: William Toohey Date: Mon, 3 May 2021 22:32:27 +1000 Subject: [PATCH] is_binary_xml: don't explode on too-short inputs --- kbinxml/kbinxml.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kbinxml/kbinxml.py b/kbinxml/kbinxml.py index 86e5e5d..d20130c 100644 --- a/kbinxml/kbinxml.py +++ b/kbinxml/kbinxml.py @@ -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))