[Spice-devel] [usbredir v2] usbredirhost: avoid access to null pointer
Victor Toso
victortoso at redhat.com
Thu Aug 4 11:57:38 UTC 2016
ERROR() is a wrapper for va_log() which takes usbredirhost* as first
argument. We can't use it if host == NULL. Changing to fprintf to not
fail the function silently.
This was catched by coverity:
3. usbredir-0.7.1/usbredirhost/usbredirhost.c:1412: var_deref_model:
Passing null pointer "host" to "va_log", which dereferences it.
4. usbredir-0.7.1/usbredirhost/usbredirhost.c:163:5: deref_parm:
Directly dereferencing parameter "host".
# 161| int n;
# 162|
# 163|-> if (level > host->verbose) {
# 164| return;
# 165| }
---
usbredirhost/usbredirhost.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 3e80677..857e821 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -1409,7 +1409,7 @@ void usbredirhost_set_buffered_output_size_cb(struct usbredirhost *host,
usbredirhost_buffered_output_size buffered_output_size_func)
{
if (!host) {
- ERROR("invalid usbredirhost");
+ fprintf(stderr, "%s: invalid usbredirhost", __func__);
return;
}
--
2.7.4
More information about the Spice-devel
mailing list