From 86f2ca0370eaec2cbd6a5af36534e8bf12954a81 Mon Sep 17 00:00:00 2001 From: Mark Kavanagh Date: Mon, 19 Feb 2018 13:48:12 +0000 Subject: [PATCH] ovs_stats: fix potential NULL dereference ovs_stats_new_port() accepts a character pointer, uuid, as a parameter, and copies it into port->uuid. Later, this value is dereferenced in ovs_stats_update_bridge(). If uuid was NULL, then a SEGV will occur. Resolve this issue by checking if uuid is NULL in ovs_stats_new_port(). Fixes: 481984e ("ovs_stats: Implement OVS statistics plugin.") Signed-off-by: Mark Kavanagh --- src/ovs_stats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ovs_stats.c b/src/ovs_stats.c index e027845e..358d10e5 100644 --- a/src/ovs_stats.c +++ b/src/ovs_stats.c @@ -244,6 +244,9 @@ static port_list_t *ovs_stats_get_port_by_name(const char *name) { /* Create or get port by port uuid */ static port_list_t *ovs_stats_new_port(bridge_list_t *bridge, const char *uuid) { + if (uuid == NULL) + return NULL; + port_list_t *port = ovs_stats_get_port(uuid); if (port == NULL) { -- 2.11.0