summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 79ce81e70e..b5ce2ea5ac 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_lib.c,v 1.102 2015/03/27 12:26:41 jsing Exp $ */ 1/* $OpenBSD: ssl_lib.c,v 1.103 2015/04/15 16:25:43 jsing 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 *
@@ -1410,11 +1410,10 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
1410} 1410}
1411 1411
1412STACK_OF(SSL_CIPHER) * 1412STACK_OF(SSL_CIPHER) *
1413ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, 1413ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num)
1414 STACK_OF(SSL_CIPHER) **skp)
1415{ 1414{
1416 const SSL_CIPHER *c; 1415 const SSL_CIPHER *c;
1417 STACK_OF(SSL_CIPHER) *sk; 1416 STACK_OF(SSL_CIPHER) *sk = NULL;
1418 int i; 1417 int i;
1419 unsigned long cipher_id; 1418 unsigned long cipher_id;
1420 uint16_t cipher_value; 1419 uint16_t cipher_value;
@@ -1428,13 +1427,10 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1428 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); 1427 SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
1429 return (NULL); 1428 return (NULL);
1430 } 1429 }
1431 if (skp == NULL || *skp == NULL) { 1430
1432 sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */ 1431 if ((sk = sk_SSL_CIPHER_new_null()) == NULL) {
1433 if (sk == NULL) 1432 SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
1434 goto err; 1433 goto err;
1435 } else {
1436 sk = *skp;
1437 sk_SSL_CIPHER_zero(sk);
1438 } 1434 }
1439 1435
1440 for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) { 1436 for (i = 0; i < num; i += SSL3_CIPHER_VALUE_SIZE) {
@@ -1486,13 +1482,11 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num,
1486 } 1482 }
1487 } 1483 }
1488 1484
1489 if (skp != NULL)
1490 *skp = sk;
1491 return (sk); 1485 return (sk);
1492 1486
1493err: 1487err:
1494 if (skp == NULL || *skp == NULL) 1488 sk_SSL_CIPHER_free(sk);
1495 sk_SSL_CIPHER_free(sk); 1489
1496 return (NULL); 1490 return (NULL);
1497} 1491}
1498 1492