Skip to content

Commit

Permalink
ovsdb: Check null before deref in ovsdb_monitor_table_condition_updat…
Browse files Browse the repository at this point in the history
…e().

I believe that this would trigger an ovsdb-server crash if a client created
a plain RFC 7047 "monitor" and later attempted to update its condition.

Found by Coverity.

Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763017&defectInstanceId=4305336&mergedDefectId=180412
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
blp committed May 30, 2017
1 parent 3387b53 commit 05b383b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ovsdb/monitor.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Nicira, Inc.
* Copyright (c) 2015, 2017 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -687,15 +687,15 @@ ovsdb_monitor_table_condition_update(
const struct ovsdb_table *table,
const struct json *cond_json)
{
if (!condition) {
return NULL;
}

struct ovsdb_monitor_table_condition *mtc =
shash_find_data(&condition->tables, table->schema->name);
struct ovsdb_error *error;
struct ovsdb_condition cond = OVSDB_CONDITION_INITIALIZER(&cond);

if (!condition) {
return NULL;
}

error = ovsdb_condition_from_json(table->schema, cond_json,
NULL, &cond);
if (error) {
Expand Down

0 comments on commit 05b383b

Please sign in to comment.