diff options
| author | kenjiro <> | 2026-08-10 20:27:51 +0000 |
|---|---|---|
| committer | kenjiro <> | 2026-08-10 20:27:51 +0000 |
| commit | 3b6943ea7f6cc543fd185d87c30f0b8a50a15a55 (patch) | |
| tree | 1f8f4db53d35da102a6b629e494e0a608d9c9012 /src | |
| parent | 43c64b4581f5552444b2f466a8aabcb274054e79 (diff) | |
| download | openbsd-3b6943ea7f6cc543fd185d87c30f0b8a50a15a55.tar.gz openbsd-3b6943ea7f6cc543fd185d87c30f0b8a50a15a55.tar.bz2 openbsd-3b6943ea7f6cc543fd185d87c30f0b8a50a15a55.zip | |
Check HMAC() return value to avoid a later use of uninitialized data
CID 25423
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/s_cb.c | 10 |
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 fcb2cd3076..b7832ff7db 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.22 2025/01/02 13:10:03 tb Exp $ */ | 1 | /* $OpenBSD: s_cb.c,v 1.23 2026/08/10 20:27:51 kenjiro 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 | * |
| @@ -847,8 +847,12 @@ generate_cookie_callback(SSL * ssl, unsigned char *cookie, | |||
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | /* Calculate HMAC of buffer using the secret */ | 849 | /* Calculate HMAC of buffer using the secret */ |
| 850 | HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, | 850 | if (HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH, |
| 851 | buffer, length, result, &resultlength); | 851 | buffer, length, result, &resultlength) == NULL) { |
| 852 | free(buffer); | ||
| 853 | return 0; | ||
| 854 | } | ||
| 855 | |||
| 852 | free(buffer); | 856 | free(buffer); |
| 853 | 857 | ||
| 854 | memcpy(cookie, result, resultlength); | 858 | memcpy(cookie, result, resultlength); |
