Re: [PATCH] network: ensure nparams is non-negative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Tuesday in 2024, Daniel P. Berrangé wrote:
The typed parameter array must be either 0, or a positive
number.


Does this matter?

The API documentation says:
 * @nparams: pointer to received number of interface parameter

and it looks like we ignore the number as long as params is NULL.

Jano

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
src/libvirt-network.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/libvirt-network.c b/src/libvirt-network.c
index ef17a8a04d..e467716b6a 100644
--- a/src/libvirt-network.c
+++ b/src/libvirt-network.c
@@ -1577,6 +1577,8 @@ virNetworkPortGetParameters(virNetworkPortPtr port,
    virCheckNetworkPortReturn(port, -1);
    conn = port->net->conn;

+    virCheckNonNegativeArgGoto(*nparams, error);
+
    if (conn->networkDriver && conn->networkDriver->networkPortGetParameters) {
        int ret;
        ret = conn->networkDriver->networkPortGetParameters(port, params, nparams, flags);
--
2.43.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux