From 66909aafb300868ffd3ed9ab02bc3bd28c49a6e9 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 23 Jun 2018 14:34:24 +0200 Subject: XEP-0153: Prevent a panic when the BINVAL is invalid. --- slixmpp/plugins/xep_0153/vcard_avatar.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slixmpp/plugins/xep_0153/vcard_avatar.py b/slixmpp/plugins/xep_0153/vcard_avatar.py index f1591e27..bbbbd2ad 100644 --- a/slixmpp/plugins/xep_0153/vcard_avatar.py +++ b/slixmpp/plugins/xep_0153/vcard_avatar.py @@ -138,7 +138,11 @@ class XEP_0153(BasePlugin): if iq['type'] == 'error': log.debug('Could not retrieve vCard for %s', jid) return - data = iq['vcard_temp']['PHOTO']['BINVAL'] + try: + data = iq['vcard_temp']['PHOTO']['BINVAL'] + except ValueError: + log.debug('Invalid BINVAL in vCard’s PHOTO for %s:', jid, exc_info=True) + data = None if not data: new_hash = '' else: -- cgit v1.2.3