summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_srtp.c
diff options
context:
space:
mode:
authorbeck <>2015-07-15 21:52:02 +0000
committerbeck <>2015-07-15 21:52:02 +0000
commite1423b93bd3553efa320e96178feb2e4fbf950d1 (patch)
tree7d066d88d08963f8b22bdaf2c1bb9bfaee2a754c /src/lib/libssl/d1_srtp.c
parent9cf0596801d610bf14fe31c968259db1d3d99182 (diff)
downloadopenbsd-e1423b93bd3553efa320e96178feb2e4fbf950d1.tar.gz
openbsd-e1423b93bd3553efa320e96178feb2e4fbf950d1.tar.bz2
openbsd-e1423b93bd3553efa320e96178feb2e4fbf950d1.zip
test for n<0 before use in CBS_init - mostly to shut up coverity.
reluctant ok miod@
Diffstat (limited to 'src/lib/libssl/d1_srtp.c')
-rw-r--r--src/lib/libssl/d1_srtp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/libssl/d1_srtp.c b/src/lib/libssl/d1_srtp.c
index 801eab1b76..8f05c4abc8 100644
--- a/src/lib/libssl/d1_srtp.c
+++ b/src/lib/libssl/d1_srtp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_srtp.c,v 1.12 2015/07/14 03:38:26 doug Exp $ */ 1/* $OpenBSD: d1_srtp.c,v 1.13 2015/07/15 21:52:02 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -303,11 +303,16 @@ ssl_parse_clienthello_use_srtp_ext(SSL *s, const unsigned char *d, int len,
303 uint16_t id; 303 uint16_t id;
304 CBS cbs, ciphers, mki; 304 CBS cbs, ciphers, mki;
305 305
306 CBS_init(&cbs, d, len); 306 if (len < 0) {
307 SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,
308 SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);
309 *al = SSL_AD_DECODE_ERROR;
310 goto done;
311 }
307 312
313 CBS_init(&cbs, d, len);
308 /* Pull off the cipher suite list */ 314 /* Pull off the cipher suite list */
309 if (len < 0 || 315 if (!CBS_get_u16_length_prefixed(&cbs, &ciphers) ||
310 !CBS_get_u16_length_prefixed(&cbs, &ciphers) ||
311 CBS_len(&ciphers) % 2 || 316 CBS_len(&ciphers) % 2 ||
312 CBS_len(&cbs) != 0) { 317 CBS_len(&cbs) != 0) {
313 SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT, 318 SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,