[Spice-commits] common/log.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Fri Mar 11 10:16:38 UTC 2016
common/log.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 53ee80bd7d1d98d87654c57098722532df55dd1b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Thu Jan 28 14:40:06 2016 +0000
Cap logging level to the valid bounds
Avoid overflows using its values.
The patch was originally written by Christophe Fergeau
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/common/log.c b/common/log.c
index a9bbebc..8d47cb6 100644
--- a/common/log.c
+++ b/common/log.c
@@ -50,7 +50,8 @@ static GLogLevelFlags spice_log_level_to_glib(SpiceLogLevel level)
[ SPICE_LOG_LEVEL_INFO ] = G_LOG_LEVEL_INFO,
[ SPICE_LOG_LEVEL_DEBUG ] = G_LOG_LEVEL_DEBUG,
};
- g_return_val_if_fail ((level >= 0) || (level < G_N_ELEMENTS(glib_levels)), 0);
+ g_return_val_if_fail (level >= 0, G_LOG_LEVEL_ERROR);
+ g_return_val_if_fail (level < G_N_ELEMENTS(glib_levels), G_LOG_LEVEL_DEBUG);
return glib_levels[level];
}
More information about the Spice-commits
mailing list