mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
nwfilter: fix NULL pointer check in virNWFilterSnoopReqNew
This can't lead to a crash since virNWFilterSnoopReqNew is only called with a static array as the argument, but if we check for NULL we should do it right.
This commit is contained in:
parent
d3337028f5
commit
cb02215252
@ -573,12 +573,12 @@ virNWFilterSnoopReqNew(const char *ifkey)
|
|||||||
{
|
{
|
||||||
virNWFilterSnoopReqPtr req;
|
virNWFilterSnoopReqPtr req;
|
||||||
|
|
||||||
if (ifkey == NULL || strlen(ifkey) != VIR_IFKEY_LEN - 1) {
|
if (ifkey == NULL || (ifkey && (strlen(ifkey) != VIR_IFKEY_LEN - 1))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("virNWFilterSnoopReqNew called with invalid "
|
_("virNWFilterSnoopReqNew called with invalid "
|
||||||
"key \"%s\" (%zu)"),
|
"key \"%s\" (%zu)"),
|
||||||
ifkey ? ifkey : "",
|
ifkey ? ifkey : "",
|
||||||
strlen(ifkey));
|
ifkey ? strlen(ifkey) : 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user