1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-11 09:17:52 +03:00

esx: Fix esxVI_String_Deserialize

It was broken since forever as it expected a libxml2
XML_ELEMENT_NODE containing a XML_TEXT_NODE instead of
just a XML_TEXT_NODE.

This problem was not discovered for so long because
esxVI_String_Deserialize was not used until now.

Reported by Ata Bohra
This commit is contained in:
Matthias Bolte 2012-07-19 00:46:21 +02:00
parent 03e0ec10b4
commit 466b306b39

View File

@ -1227,11 +1227,26 @@ esxVI_String_SerializeValue(const char *value, const char *element,
return 0;
}
/* esxVI_String_Deserialize */
ESX_VI__TEMPLATE__DESERIALIZE(String,
int
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
{
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, value)
})
if (string == NULL || *string != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
return -1;
}
if (esxVI_String_Alloc(string) < 0 ||
esxVI_String_DeserializeValue(node, &(*string)->value) < 0) {
goto failure;
}
return 0;
failure:
esxVI_String_Free(string);
return -1;
}
/* esxVI_String_DeserializeList */
ESX_VI__TEMPLATE__LIST__DESERIALIZE(String)