]> git.ipfire.org Git - thirdparty/libvirt.git/commit
_virtualboxCreateMachine: Avoid unbounded stack
authorMichal Privoznik <mprivozn@redhat.com>
Sat, 5 Mar 2016 11:59:45 +0000 (12:59 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Mar 2016 08:53:24 +0000 (09:53 +0100)
commit18f231e6ff953c014f4ef0a75da7bf20c4f35de9
tree696d18b94cdd5b3aa6bf2b97b95b52833da0c4bd
parenteff43d9abac0e0df9779ee412b7aeaccea8f6e2a
_virtualboxCreateMachine: Avoid unbounded stack

If the stars are in the right position and you're building with
VBox >= 4.2.0 it will happen that compiler thinks an array
allocated on the stack may be unbounded:

In file included from vbox/vbox_V4_2.c:13:0:
vbox/vbox_tmpl.c: In function '_virtualboxCreateMachine':
vbox/vbox_tmpl.c:2811:1: error: stack usage might be unbounded [-Werror=stack-usage=]
 _virtualboxCreateMachine(vboxGlobalData *data, virDomainDefPtr def, IMachine **machine, char *uuidstr ATTRIBUTE_UNUSED)
 ^

Well, given how the variable is declared, I had some hard time
seeing it is actually bounded. Surprisingly compiler does not
complain because of -Wframe-larger-than. This is because
variable length arrays do not count into that warning.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/vbox/vbox_tmpl.c