[libvirt] [libvirt-sandbox][PATCH] Avoid infinite loop in gvir_sandbox_config_set_security_opts()

Daniel P. Berrange berrange at redhat.com
Fri Mar 15 09:44:22 UTC 2013


On Fri, Mar 15, 2013 at 05:32:24PM +0800, Alex Jia wrote:
> 
> Signed-off-by: Alex Jia <ajia at redhat.com>
> ---
>  libvirt-sandbox/libvirt-sandbox-config.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-sandbox/libvirt-sandbox-config.c b/libvirt-sandbox/libvirt-sandbox-config.c
> index 90217f1..f96d417 100644
> --- a/libvirt-sandbox/libvirt-sandbox-config.c
> +++ b/libvirt-sandbox/libvirt-sandbox-config.c
> @@ -1356,10 +1356,13 @@ gboolean gvir_sandbox_config_set_security_opts(GVirSandboxConfig *config,
>  
>          if (strncmp(name, "label=", 5) == 0) {
>              gvir_sandbox_config_set_security_label(config, value);
> +            break;
>          } else if (g_str_equal(name, "dynamic")) {
>              gvir_sandbox_config_set_security_dynamic(config, TRUE);
> +            break;
>          } else if (g_str_equal(name, "static")) {
>              gvir_sandbox_config_set_security_dynamic(config, FALSE);
> +            break;
>          } else {
>              g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
>                          "Unknown security option '%s'", name);

Actually the real flaw is that we're missing  'i++' as the last line of
the loop body.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list