From edb0540bbcc624675b8745f52e085ef15d0fa023 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Thu, 17 Nov 2011 14:08:09 -0800 Subject: [PATCH] ofproto-dpif: Fix segfault in mirror_update_dups(). Fixes crash introduced in 9ba15e (ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).) The code always dereferenced the members of the "mirrors" array in ofproto even if they were null. --- ofproto/ofproto-dpif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 86723e146..3e92493c2 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1682,7 +1682,7 @@ mirror_update_dups(struct ofproto_dpif *ofproto) for (j = i + 1; j < MAX_MIRRORS; j++) { struct ofmirror *m2 = ofproto->mirrors[j]; - if (m1->out == m2->out && m1->out_vlan == m2->out_vlan) { + if (m2 && m1->out == m2->out && m1->out_vlan == m2->out_vlan) { m1->dup_mirrors |= MIRROR_MASK_C(1) << j; m2->dup_mirrors |= m1->dup_mirrors; } -- 2.43.0