From: Ben Pfaff Date: Wed, 23 Feb 2011 20:42:44 +0000 (-0800) Subject: ovsdb-idl: JSONRPC_REPLY message always has nonnull 'id'. X-Git-Tag: v1.1.0~226 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0f0b102dcf5c067259788e54a0a5352851ed1565;p=sliver-openvswitch.git ovsdb-idl: JSONRPC_REPLY message always has nonnull 'id'. A JSONRPC_REPLY message always have a nonnull 'id' member, as ensured by jsonrpc_msg_is_valid(). Checking for NULL here confused Coverity into believing that the call to ovsdb_idl_txn_process_reply() just below could cause a null pointer dereference, since ovsdb_idl_txn_process_reply() uses the 'id' member without checking it for null. Coverity #10713. --- diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index e7f19e4cf..b264591da 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010 Nicira Networks. +/* Copyright (c) 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -312,8 +312,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl) idl->monitor_request_id = NULL; ovsdb_idl_clear(idl); ovsdb_idl_parse_update(idl, msg->result); - } else if (msg->type == JSONRPC_REPLY - && msg->id && msg->id->type == JSON_STRING + } else if (msg->type == JSONRPC_REPLY && msg->id->type == JSON_STRING && !strcmp(msg->id->u.string, "echo")) { /* It's a reply to our echo request. Ignore it. */ } else if ((msg->type == JSONRPC_ERROR