diff options
author | tb <> | 2020-05-04 14:20:36 +0000 |
---|---|---|
committer | tb <> | 2020-05-04 14:20:36 +0000 |
commit | 8b8f4425fc0851a2c66a95a7cb36b974dcd60b64 (patch) | |
tree | c45efe8d6ff1d0f1610e38d37ca5337248a9962c | |
parent | 7a3a8eb5b74aad740ccb6e2e651923eca93ed061 (diff) | |
download | openbsd-8b8f4425fc0851a2c66a95a7cb36b974dcd60b64.tar.gz openbsd-8b8f4425fc0851a2c66a95a7cb36b974dcd60b64.tar.bz2 openbsd-8b8f4425fc0851a2c66a95a7cb36b974dcd60b64.zip |
Fix out-of-bounds access in tables[][] that was exposed in bluhm's
regress on i386 after inoguchi moved some symbols to const.
ok inoguchi jsing deraadt
-rw-r--r-- | src/regress/lib/libssl/handshake/handshake_table.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/regress/lib/libssl/handshake/handshake_table.c b/src/regress/lib/libssl/handshake/handshake_table.c index a8c68970db..2728dd84a1 100644 --- a/src/regress/lib/libssl/handshake/handshake_table.c +++ b/src/regress/lib/libssl/handshake/handshake_table.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: handshake_table.c,v 1.13 2020/04/22 17:05:53 jsing Exp $ */ | 1 | /* $OpenBSD: handshake_table.c,v 1.14 2020/05/04 14:20:36 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2019 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2019 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -21,6 +21,8 @@ | |||
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | 23 | ||
24 | #define MAX_FLAGS (UINT8_MAX + 1) | ||
25 | |||
24 | #include "tls13_handshake.h" | 26 | #include "tls13_handshake.h" |
25 | 27 | ||
26 | /* | 28 | /* |
@@ -134,7 +136,7 @@ static struct child stateinfo[][TLS13_NUM_MESSAGE_TYPES] = { | |||
134 | const size_t stateinfo_count = sizeof(stateinfo) / sizeof(stateinfo[0]); | 136 | const size_t stateinfo_count = sizeof(stateinfo) / sizeof(stateinfo[0]); |
135 | 137 | ||
136 | void build_table(enum tls13_message_type | 138 | void build_table(enum tls13_message_type |
137 | table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES], | 139 | table[MAX_FLAGS][TLS13_NUM_MESSAGE_TYPES], |
138 | struct child current, struct child end, | 140 | struct child current, struct child end, |
139 | struct child path[], uint8_t flags, unsigned int depth); | 141 | struct child path[], uint8_t flags, unsigned int depth); |
140 | size_t count_handshakes(void); | 142 | size_t count_handshakes(void); |
@@ -152,7 +154,7 @@ void fprint_flags(FILE *stream, uint8_t flags); | |||
152 | const char *mt2str(enum tls13_message_type mt); | 154 | const char *mt2str(enum tls13_message_type mt); |
153 | __dead void usage(void); | 155 | __dead void usage(void); |
154 | int verify_table(enum tls13_message_type | 156 | int verify_table(enum tls13_message_type |
155 | table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES], int print); | 157 | table[MAX_FLAGS][TLS13_NUM_MESSAGE_TYPES], int print); |
156 | 158 | ||
157 | const char * | 159 | const char * |
158 | flag2str(uint8_t flag) | 160 | flag2str(uint8_t flag) |
@@ -370,7 +372,7 @@ count_handshakes(void) | |||
370 | } | 372 | } |
371 | 373 | ||
372 | void | 374 | void |
373 | build_table(enum tls13_message_type table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES], | 375 | build_table(enum tls13_message_type table[MAX_FLAGS][TLS13_NUM_MESSAGE_TYPES], |
374 | struct child current, struct child end, struct child path[], uint8_t flags, | 376 | struct child current, struct child end, struct child path[], uint8_t flags, |
375 | unsigned int depth) | 377 | unsigned int depth) |
376 | { | 378 | { |
@@ -409,7 +411,7 @@ build_table(enum tls13_message_type table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES], | |||
409 | } | 411 | } |
410 | 412 | ||
411 | int | 413 | int |
412 | verify_table(enum tls13_message_type table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES], | 414 | verify_table(enum tls13_message_type table[MAX_FLAGS][TLS13_NUM_MESSAGE_TYPES], |
413 | int print) | 415 | int print) |
414 | { | 416 | { |
415 | int success = 1, i; | 417 | int success = 1, i; |
@@ -458,7 +460,7 @@ int | |||
458 | main(int argc, char *argv[]) | 460 | main(int argc, char *argv[]) |
459 | { | 461 | { |
460 | static enum tls13_message_type | 462 | static enum tls13_message_type |
461 | hs_table[UINT8_MAX][TLS13_NUM_MESSAGE_TYPES] = { | 463 | hs_table[MAX_FLAGS][TLS13_NUM_MESSAGE_TYPES] = { |
462 | [INITIAL] = { | 464 | [INITIAL] = { |
463 | CLIENT_HELLO, | 465 | CLIENT_HELLO, |
464 | SERVER_HELLO_RETRY_REQUEST, | 466 | SERVER_HELLO_RETRY_REQUEST, |