libpldm: Modify the validation check on ActiveComponentVersionString

ActiveComponentVersionStringLength in ComponentParameterTable can
be zero if the component is corrupted for any reason. Update
decode_get_firmware_parameters_resp_comp_entry to handle that
correctly.

Signed-off-by: Tom Joseph <rushtotom@gmail.com>
Change-Id: I43624a9d55524db3ee77eb3f2d4ebe83a247597a
diff --git a/libpldm/firmware_update.c b/libpldm/firmware_update.c
index 1aa0ed1..023fc4f 100644
--- a/libpldm/firmware_update.c
+++ b/libpldm/firmware_update.c
@@ -782,9 +782,6 @@
 
 	struct pldm_component_parameter_entry *entry =
 	    (struct pldm_component_parameter_entry *)(data);
-	if (entry->active_comp_ver_str_len == 0) {
-		return PLDM_ERROR_INVALID_LENGTH;
-	}
 
 	size_t entry_length = sizeof(struct pldm_component_parameter_entry) +
 			      entry->active_comp_ver_str_len +
@@ -822,9 +819,14 @@
 	component_data->capabilities_during_update.value =
 	    le32toh(entry->capabilities_during_update.value);
 
-	active_comp_ver_str->ptr =
-	    data + sizeof(struct pldm_component_parameter_entry);
-	active_comp_ver_str->length = entry->active_comp_ver_str_len;
+	if (entry->active_comp_ver_str_len != 0) {
+		active_comp_ver_str->ptr =
+		    data + sizeof(struct pldm_component_parameter_entry);
+		active_comp_ver_str->length = entry->active_comp_ver_str_len;
+	} else {
+		active_comp_ver_str->ptr = NULL;
+		active_comp_ver_str->length = 0;
+	}
 
 	if (entry->pending_comp_ver_str_len != 0) {