From fff8d09d2a4cc7be0eadce567a0c19dada27110e Mon Sep 17 00:00:00 2001 From: Alexander Neff Date: Mon, 10 Mar 2025 16:04:41 +0100 Subject: [PATCH] If len(val_list) is zero val_list[0] will crash, this will now return the empty list --- nxc/parsers/ldap_results.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nxc/parsers/ldap_results.py b/nxc/parsers/ldap_results.py index c12be0e1..da7f90d1 100644 --- a/nxc/parsers/ldap_results.py +++ b/nxc/parsers/ldap_results.py @@ -18,6 +18,9 @@ def parse_result_attributes(ldap_response): # If we can't decode the value, we'll just return the bytes val_decoded = val.__bytes__() val_list.append(val_decoded) - attribute_map[str(attribute["type"])] = val_list if len(val_list) > 1 else val_list[0] + if len(val_list) == 1: + attribute_map[str(attribute["type"])] = val_list[0] + else: + attribute_map[str(attribute["type"])] = val_list parsed_response.append(attribute_map) return parsed_response