Fix incorrect result of rdb_increment on overflow

Signed-off-by: lb1107039128 <liubo1@xfusion.com>
This commit is contained in:
lb1107039128 2023-12-27 16:22:58 +08:00
parent c07352e15f
commit 6fc6f05a76
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,28 @@
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

View File

@ -1,6 +1,6 @@
Name: libsrtp
Version: 1.5.4
Release: 10
Release: 11
Summary: Library for SRTP (Secure Realtime Transport Protocol)
License: BSD
URL: https://github.com/cisco/libsrtp
@ -13,6 +13,7 @@ Patch0000: libsrtp-1.5.4-shared-fix.patch
Patch0001: libsrtp-srtp_aes_encrypt.patch
Patch0002: libsrtp-sha1-name-fix.patch
Patch0003: libsrtp-fix-name-collision-on-MIPS.patch
Patch0004: 0001-Fix-incorrect-result-of-rdb_increment-on-overflow.patch
%description
This package provides an implementation of the Secure Real-time Transport Protocol (SRTP),
@ -56,5 +57,8 @@ install -pm644 %{SOURCE2} %{buildroot}%{_includedir}/srtp/config.h
%{_libdir}/*.so
%changelog
* Wed Dec 27 2023 liubo <liubo1@xfusion.com> - 1.5.4-11
- Fix incorrect result of rdb_increment on overflow
* Tue Oct 23 2019 huzhiyu <huzhiyu1@huawei.com> - 1.5.4-10
- Package init