From 31608b148049ecbea3f536ef4c61231702615cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 15 Mar 2021 14:09:48 +0100 Subject: [PATCH] chg: strip NULL string from value https://github.com/MISP/PyMISP/issues/678 --- pymisp/mispevent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index 218dea0..8a23a1d 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -917,7 +917,7 @@ class MISPObject(AbstractMISP): if simple_value is not None: # /!\ The value *can* be 0 value['value'] = simple_value if value.get('value') is None: - logger.warning("The value of the attribute you're trying to add is None or empty string, skipping it. Object relation: {}".format(object_relation)) + logger.warning("The value of the attribute you're trying to add is None, skipping it. Object relation: {}".format(object_relation)) return None else: if isinstance(value['value'], bytes): @@ -931,7 +931,7 @@ class MISPObject(AbstractMISP): # Make sure we're not adding an empty value. if isinstance(value['value'], str): - value['value'] = value['value'].strip() + value['value'] = value['value'].strip().strip('\x00') if value['value'] == '': logger.warning("The value of the attribute you're trying to add is an empty string, skipping it. Object relation: {}".format(object_relation)) return None