From 7df6a8bdb4abe4ac41c6d1a9043b69cbaea23bcc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 13 May 2011 16:50:20 -0700 Subject: [PATCH] ofproto-dpif: Fix null pointer dereference in get_ofp_port(). --- ofproto/ofproto-dpif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 93acd429..b7194930 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1353,7 +1353,8 @@ is_mirror_output_bundle(struct ofproto *ofproto_, void *aux) static struct ofport_dpif * get_ofp_port(struct ofproto_dpif *ofproto, uint16_t ofp_port) { - return ofport_dpif_cast(ofproto_get_port(&ofproto->up, ofp_port)); + struct ofport *ofport = ofproto_get_port(&ofproto->up, ofp_port); + return ofport ? ofport_dpif_cast(ofport) : NULL; } static struct ofport_dpif * -- 2.30.2