]> xenbits.xensource.com Git - libvirt.git/commitdiff
admin: Add a check to reject negative argument for number of typed params
authorErik Skultety <eskultet@redhat.com>
Tue, 3 May 2016 15:04:42 +0000 (17:04 +0200)
committerErik Skultety <eskultet@redhat.com>
Wed, 4 May 2016 14:36:22 +0000 (16:36 +0200)
Since nparams can be technically negative, it is a good practice throughout
our code to check if nparams actually has a non-negative value. The same effect
would be achieved by converting our internal typed params serializer argument
to 'unsigned' type, but it definitely would not be the path of least resistance.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
src/libvirt-admin.c

index a94f5dd1d30312a315b8bfaa6ca65828f35c8b22..4ad816b1fc229a2448f7cb7645c2dc5a331e967d 100644 (file)
@@ -838,6 +838,7 @@ virAdmServerSetThreadPoolParameters(virAdmServerPtr srv,
 
     virCheckAdmServerReturn(srv, -1);
     virCheckNonNullArgGoto(params, error);
+    virCheckNonNegativeArgGoto(nparams, error);
 
     if (remoteAdminServerSetThreadPoolParameters(srv, params,
                                                  nparams, flags) < 0)