From f2ae5c310c9cc159602e550cc1bf73453eeb6198 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 24 Apr 2017 12:18:30 +0300 Subject: [PATCH] Fix incorrect result of rdb_increment on overflow The rdb_increment used to return err_status_ok when overflow has happened, which results in undesirable consequences in other parts of the code. --- crypto/replay/rdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/replay/rdb.c b/crypto/replay/rdb.c index c84222fd0..5202a9ba9 100644 --- a/crypto/replay/rdb.c +++ b/crypto/replay/rdb.c @@ -130,8 +130,9 @@ rdb_add_index(rdb_t *rdb, uint32_t p_index) { err_status_t rdb_increment(rdb_t *rdb) { - if (rdb->window_start++ > 0x7fffffff) + if (rdb->window_start >= 0x7fffffff) return err_status_key_expired; + ++rdb->window_start; return err_status_ok; }