diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-07-14 11:50:08 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-07-14 18:50:33 +0000 |
commit | 4f1b8d74338ca2a6ded8498e9d87cbc3294454c0 (patch) | |
tree | f522417e51cb0321e94b0796a44db31c420f94ef /epan/crypt | |
parent | 9230834fbe06f893bd581ab889b94122df5a9998 (diff) | |
download | wireshark-4f1b8d74338ca2a6ded8498e9d87cbc3294454c0.tar.gz |
Add a bounds check.
AirPDcapStoreSa() was assuming that ctx->first_free_index would always
be within the ctx->sa array; nothing guarantees that. Fail if it's past
the end of the array; that means there *are* no free indices.
Change-Id: I73145ea3f3dda1b3800a41fa3a2b01ac344dcbfc
Reviewed-on: https://code.wireshark.org/review/9634
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/crypt')
-rw-r--r-- | epan/crypt/airpdcap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/epan/crypt/airpdcap.c b/epan/crypt/airpdcap.c index 6533edf05a..0f295cde53 100644 --- a/epan/crypt/airpdcap.c +++ b/epan/crypt/airpdcap.c @@ -1555,6 +1555,10 @@ AirPDcapStoreSa( { INT last_free; + if (ctx->first_free_index>=AIRPDCAP_MAX_SEC_ASSOCIATIONS_NR) { + /* there is no empty space available. FAILURE */ + return -1; + } if (ctx->sa[ctx->first_free_index].used) { /* last addition was in the middle of the array (and the first_free_index was just incremented by 1) */ /* search for a free space from the first_free_index to AIRPDCAP_STA_INFOS_NR (to avoid free blocks in */ |