mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
virNodeDeviceCapVPDParseCustomFields: Don't use 'virXPathStringLimit'
virXPathStringLimit doesn't give callers a way to differentiate between the queried XPath being empty and the length limit being exceeded. This means that callers are overwriting the error message. Move the length checks into the caller. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
712a04bca1
commit
8f9bc6e5f6
@ -955,7 +955,8 @@ virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt, virPCIVPDResource
|
||||
g_autofree char *keyword = NULL;
|
||||
|
||||
ctxt->node = nodes[i];
|
||||
if (!(index = virXPathStringLimit("string(./@index[1])", 2, ctxt))) {
|
||||
if (!(index = virXPathString("string(./@index[1])", ctxt)) ||
|
||||
strlen(index) > 1) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("<vendor_field> evaluation has failed"));
|
||||
continue;
|
||||
@ -983,7 +984,8 @@ virNodeDeviceCapVPDParseCustomFields(xmlXPathContextPtr ctxt, virPCIVPDResource
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
ctxt->node = nodes[i];
|
||||
if (!(index = virXPathStringLimit("string(./@index[1])", 2, ctxt))) {
|
||||
if (!(index = virXPathString("string(./@index[1])", ctxt)) ||
|
||||
strlen(index) > 1) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("<system_field> evaluation has failed"));
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user