From 86baf547e7d3c1be4ff177e604a1d90b76725560 Mon Sep 17 00:00:00 2001 From: jsing Date: Mon, 11 Aug 2014 10:46:19 +0000 Subject: [PATCH] Check the return value of sk_SSL_CIPHER_new_null(), since it allocates memory and can return NULL. ok miod@ --- lib/libssl/src/ssl/ssl_lib.c | 12 +++++++----- lib/libssl/ssl_lib.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/libssl/src/ssl/ssl_lib.c b/lib/libssl/src/ssl/ssl_lib.c index b3f42102665..55ab469df5b 100644 --- a/lib/libssl/src/ssl/ssl_lib.c +++ b/lib/libssl/src/ssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.80 2014/08/11 01:10:42 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.81 2014/08/11 10:46:19 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1417,10 +1417,12 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); return (NULL); } - if ((skp == NULL) || (*skp == NULL)) - sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */ - else { - sk= *skp; + if (skp == NULL || *skp == NULL) { + sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */ + if (sk == NULL) + goto err; + } else { + sk = *skp; sk_SSL_CIPHER_zero(sk); } diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index b3f42102665..55ab469df5b 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.80 2014/08/11 01:10:42 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.81 2014/08/11 10:46:19 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1417,10 +1417,12 @@ ssl_bytes_to_cipher_list(SSL *s, unsigned char *p, int num, SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST); return (NULL); } - if ((skp == NULL) || (*skp == NULL)) - sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */ - else { - sk= *skp; + if (skp == NULL || *skp == NULL) { + sk = sk_SSL_CIPHER_new_null(); /* change perhaps later */ + if (sk == NULL) + goto err; + } else { + sk = *skp; sk_SSL_CIPHER_zero(sk); } -- 2.20.1