mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
interface_conf.c: don't use a negative value as allocation size
* src/conf/interface_conf.c (virInterfaceDefParseProtoIPv4): If virXPathNodeSet returns -1, indicate failure by returning -1 right away. (virInterfaceDefParseProtoIPv6): Likewise.
This commit is contained in:
parent
71c865f4d2
commit
fe1183a7cd
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* interface_conf.c: interfaces XML handling
|
* interface_conf.c: interfaces XML handling
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2009 Red Hat, Inc.
|
* Copyright (C) 2006-2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -320,6 +320,8 @@ virInterfaceDefParseProtoIPv4(virConnectPtr conn, virInterfaceProtocolDefPtr def
|
|||||||
}
|
}
|
||||||
|
|
||||||
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
|
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
|
||||||
|
if (nIpNodes < 0)
|
||||||
|
return -1;
|
||||||
if (ipNodes == NULL)
|
if (ipNodes == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -377,6 +379,8 @@ virInterfaceDefParseProtoIPv6(virConnectPtr conn, virInterfaceProtocolDefPtr def
|
|||||||
}
|
}
|
||||||
|
|
||||||
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
|
nIpNodes = virXPathNodeSet(conn, "./ip", ctxt, &ipNodes);
|
||||||
|
if (nIpNodes < 0)
|
||||||
|
return -1;
|
||||||
if (ipNodes == NULL)
|
if (ipNodes == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user