[vlc-devel] commit: SRTP: check buffer length before sequence ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Jun 15 21:39:25 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jun 15 22:40:33 2008 +0300| [bc3af7e7aadb33cb0940e50fa270a165192a06bc]
SRTP: check buffer length before sequence
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc3af7e7aadb33cb0940e50fa270a165192a06bc
---
libs/srtp/srtp.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libs/srtp/srtp.c b/libs/srtp/srtp.c
index dcde338..ec49101 100644
--- a/libs/srtp/srtp.c
+++ b/libs/srtp/srtp.c
@@ -600,17 +600,21 @@ int
srtp_send (srtp_session_t *s, uint8_t *buf, size_t *lenp, size_t bufsize)
{
size_t len = *lenp;
- int val = srtp_crypt (s, buf, len);
- if (val)
- return val;
+ size_t tag_len = s->tag_len;
if (!(s->flags & SRTP_UNAUTHENTICATED))
{
- size_t tag_len = s->tag_len;
*lenp = len + tag_len;
if (bufsize < (len + tag_len))
return ENOSPC;
+ }
+
+ int val = srtp_crypt (s, buf, len);
+ if (val)
+ return val;
+ if (!(s->flags & SRTP_UNAUTHENTICATED))
+ {
uint32_t roc = srtp_compute_roc (s, rtp_seq (buf));
const uint8_t *tag = rtp_digest (s, buf, len, roc);
if (rcc_mode (s))
More information about the vlc-devel
mailing list