summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-08-30 20:40:14 +0000
committertb <>2022-08-30 20:40:14 +0000
commita2701e1610925369192d4d0f4f871abf3115d2d0 (patch)
tree7f1f06fd8ad73629489d5e31750cad21def186de /src
parente0dee7e930b0265d6f81267fc0d9c9ce1dea38e5 (diff)
downloadopenbsd-a2701e1610925369192d4d0f4f871abf3115d2d0.tar.gz
openbsd-a2701e1610925369192d4d0f4f871abf3115d2d0.tar.bz2
openbsd-a2701e1610925369192d4d0f4f871abf3115d2d0.zip
Check HMAC() return value to avoid a later use of uninitialized
CID 25421
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/s_cb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/s_cb.c b/src/usr.bin/openssl/s_cb.c
index 12a6c308fb..ffaa4c5b4d 100644
--- a/src/usr.bin/openssl/s_cb.c
+++ b/src/usr.bin/openssl/s_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_cb.c,v 1.18 2022/02/03 18:40:34 tb Exp $ */ 1/* $OpenBSD: s_cb.c,v 1.19 2022/08/30 20:40:14 tb 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 *
@@ -914,8 +914,12 @@ verify_cookie_callback(SSL * ssl, const unsigned char *cookie,
914 } 914 }
915 915
916 /* Calculate HMAC of buffer using the secret */ 916 /* Calculate HMAC of buffer using the secret */
917 HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, 917 if (HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
918 buffer, length, result, &resultlength); 918 buffer, length, result, &resultlength) == NULL) {
919 free(buffer);
920 return 0;
921 }
922
919 free(buffer); 923 free(buffer);
920 924
921 if (cookie_len == resultlength && 925 if (cookie_len == resultlength &&