libsrtp/0001-Fix-incorrect-result-of-rdb_increment-on-overflow.patch
lb1107039128 6fc6f05a76 Fix incorrect result of rdb_increment on overflow
Signed-off-by: lb1107039128 <liubo1@xfusion.com>
2023-12-27 16:22:58 +08:00

29 lines
903 B
Diff

From f2ae5c310c9cc159602e550cc1bf73453eeb6198 Mon Sep 17 00:00:00 2001
From: Andrey Semashev <Lastique@users.noreply.github.com>
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 c84222f..5202a9b 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;
}
--
2.42.0.windows.2