ovsdb: Check null before deref in ovsdb_monitor_table_condition_update().
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:
/*
- * 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.
@@ -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) {
