Wireshark-commits: [Wireshark-commits] master e48ab21: BER: Fix order of loop tests to avoid overru

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 16 Aug 2020 21:49:18 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=e48ab21267c90bf5f870003299e00ea1656e2d7e
Submitter: "Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

e48ab21 by Martin Mathieson (martin.mathieson@xxxxxxxxxxxx):

    BER: Fix order of loop tests to avoid overrunning array.
    
    Reported by cppcheck:
    
    epan/dissectors/packet-ber.c:2603:35: warning: Array index 'set_idx' is used before limits check. [arrayIndexThenCheck]
        for (set_idx = 0; (cset = &set[set_idx])->func && (set_idx < MAX_SET_ELEMENTS); set_idx++) {
                                      ^
    epan/dissectors/packet-ber.c:2759:40: warning: Array index 'set_idx' is used before limits check. [arrayIndexThenCheck]
            for (set_idx = 0;  (cset = &set[set_idx])->func && (set_idx < MAX_SET_ELEMENTS); set_idx++) {
                                           ^
    
    Change-Id: Ifbb9f1d2e9062a5c55190ea68df2226f3af8f21a
    Reviewed-on: https://code.wireshark.org/review/38166
    Petri-Dish: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Pascal Quantin <pascal@xxxxxxxxxxxxx>
    Reviewed-by: Martin Mathieson <martin.r.mathieson@xxxxxxxxxxxxxx>
    

Actions performed:

    from  521180d   [Automatic update for 2020-08-16]
     add  e48ab21   BER: Fix order of loop tests to avoid overrunning array.


Summary of changes:
 epan/dissectors/packet-ber.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)