diff --git a/source/server/apistatusd.py b/source/server/apistatusd.py index 9a89b4a..d6ef14e 100755 --- a/source/server/apistatusd.py +++ b/source/server/apistatusd.py @@ -132,9 +132,18 @@ def receive_buffer_is_valid(raw_data): param 1: byte object return: boolean ''' - if raw_data.decode('utf-8', 'strict') in ('0', '1'): - logging.debug('Argument is valid: {}'.format(raw_data)) - return True + try: + if raw_data.decode('utf-8', 'strict') in ('0', '1'): + logging.debug('Argument is valid: {}'.format(raw_data)) + return True + except UnicodeDecodeError as err: + logging.error('Argument is not valid unicode') + logging.error(err) + return False + except Exception as err: + logging.error('Exception occurred') + logging.error(err) + return False logging.debug('Argument is not valid: {}'.format(raw_data)) return False