diff options
author | Matt Caswell <matt@openssl.org> | 2018-10-26 15:29:15 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-11-08 11:31:22 +0000 |
commit | efd67e01a5471f9b0745018d7707b69876b070f6 (patch) | |
tree | b5b217a7901ae9801413552087fd27e4f5a9927a /ssl | |
parent | f306b9e62a375add764c7d9de6e311aaa0229865 (diff) |
Give a better error if an attempt is made to set a zero length groups list
Previously we indicated this as a malloc failure which isn't very
helpful.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/7479)
(cherry picked from commit 680bd131b69d57e891888ab70d300176a5a16617)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/t1_lib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 156497988a..b8b9fbda39 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -343,6 +343,10 @@ int tls1_set_groups(uint16_t **pext, size_t *pextlen, */ unsigned long dup_list = 0; + if (ngroups == 0) { + SSLerr(SSL_F_TLS1_SET_GROUPS, SSL_R_BAD_LENGTH); + return 0; + } if ((glist = OPENSSL_malloc(ngroups * sizeof(*glist))) == NULL) { SSLerr(SSL_F_TLS1_SET_GROUPS, ERR_R_MALLOC_FAILURE); return 0; |