mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-08-08 09:18:08 +00:00
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@redhat.com>
This commit is contained in:
parent
8af947e7b2
commit
53ee80bd7d
@ -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];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user