Skip to content

Commit

Permalink
cachedb_mongodb: Fix possible crash in counter add/sub
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuchircu committed Feb 7, 2018
1 parent d6933ad commit 8345ff2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/cachedb_mongodb/cachedb_mongodb_dbase.c
Expand Up @@ -967,6 +967,9 @@ int mongo_con_add(cachedb_con *con, str *attr, int val, int expires, int *new_va
stop_expire_timer(start, mongo_exec_threshold, "MongoDB counter add",
NULL, 0, 0);

if (!new_val)
goto out;

if (bson_iter_init_find(&iter, &reply, "value") &&
BSON_ITER_HOLDS_DOCUMENT(&iter) &&
bson_iter_recurse(&iter, &sub_iter)) {
Expand Down

0 comments on commit 8345ff2

Please sign in to comment.