From e5b7f1e266103b06cf00361c9f483e080e3543ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 15 Mar 2024 10:47:07 +0000 Subject: [PATCH] network: ensure nparams is non-NULL and non-negative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The typed parameter array length must be non-NULL and either 0, or a positive number. Reviewed-by: Ján Tomko Signed-off-by: Daniel P. Berrangé --- src/libvirt-network.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libvirt-network.c b/src/libvirt-network.c index ef17a8a04d..833b1adbff 100644 --- a/src/libvirt-network.c +++ b/src/libvirt-network.c @@ -1577,6 +1577,9 @@ virNetworkPortGetParameters(virNetworkPortPtr port, virCheckNetworkPortReturn(port, -1); conn = port->net->conn; + virCheckNonNullArgGoto(nparams, error); + virCheckNonNegativeArgGoto(*nparams, error); + if (conn->networkDriver && conn->networkDriver->networkPortGetParameters) { int ret; ret = conn->networkDriver->networkPortGetParameters(port, params, nparams, flags);