[ovs-dev,1/8] vconn: Avoid null dereference on error path.

Message ID 20180830200056.15484-1-blp@ovn.org
State Accepted
Headers show
Series
  • [ovs-dev,1/8] vconn: Avoid null dereference on error path.
Related show

Commit Message

Ben Pfaff Aug. 30, 2018, 8 p.m.
Sometimes the 'errors' list is passed as null, and in that case it should
not be used.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/vconn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Justin Pettit Oct. 23, 2018, 9:03 p.m. | #1
> On Aug 30, 2018, at 1:00 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> Sometimes the 'errors' list is passed as null, and in that case it should
> not be used.
> 
> Found by inspection.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Acked-by: Justin Pettit <jpettit@ovn.org>

--Justin

Patch

diff --git a/lib/vconn.c b/lib/vconn.c
index e95ecbfa78a3..4d5f308d8836 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -772,7 +772,7 @@  vconn_recv_xid__(struct vconn *vconn, ovs_be32 xid, struct ofpbuf **replyp,
         }
 
         error = ofptype_decode(&type, oh);
-        if (!error && type == OFPTYPE_ERROR) {
+        if (!error && type == OFPTYPE_ERROR && errors) {
             ovs_list_push_back(errors, &reply->list_node);
         } else {
             VLOG_DBG_RL(&bad_ofmsg_rl, "%s: received reply with xid %08"PRIx32