[Libguestfs] [PATCH libnbd 5/9] generator: On entry to API functions, check Enum parameters.
Eric Blake
eblake at redhat.com
Sat Aug 10 17:42:15 UTC 2019
On 8/10/19 8:02 AM, Richard W.M. Jones wrote:
> In the generated wrapper code this adds checks for all Enum
> parameters. Since only nbd_set_tls uses an Enum parameter, the only
> extra code generated by this change is:
>
> int
> nbd_set_tls (struct nbd_handle *h, int tls) {
> // ...
> switch (tls) {
> case LIBNBD_TLS_DISABLE:
> case LIBNBD_TLS_ALLOW:
> case LIBNBD_TLS_REQUIRE:
> break;
> default:
> set_error (EINVAL, "%s: invalid value for parameter: %d",
> "tls", tls);
> ret = -1;
> goto out;
> }
>
> This doesn't change the C API, but previously this parameter was not
> checked. So programs using this API which previously happened to work
> would now get an error.
programs using this API with an out-of-bounds value
(it doesn't change programs using it as documented)
> ---
> generator/generator | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
ACK.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190810/a205d37c/attachment.sig>
More information about the Libguestfs
mailing list