Wireshark-commits: [Wireshark-commits] master 9f1b91a: csn1: fix: do not return 0 if no more bits l
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 26 Mar 2020 21:43:56 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9f1b91a4a0a53796d868a218b853dbf2ca5f33b8
Submitter: "Gerald Combs <gerald@xxxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

9f1b91a by Vadim Yanitskiy (axilirator@xxxxxxxxx):

    csn1: fix: do not return 0 if no more bits left in the buffer
    
    The csnStreamDissector() shall not return 0 prematurely if no more
    bits left in the input buffer. Otherwise some malformed packets
    may not be displayed by Wireshark as such, confusing the user(s).
    
    There are two possible cases:
    
      a) The number of remaining bits is negative - this is an error
         in any case. Return CSN_ERROR_NEED_MORE_BITS_TO_UNPACK.
    
      b) The number of remaining bits is zero - this might be an error
         or not depending on particular CSN.1 definition. We don't
         know in advance without entering the parsing loop.
    
    In case a) everything is simple, while in case b) we should not
    make precipitate decicions. Some CSN.1 definitions have names
    like 'M_*_OR_NULL', what basically means that they're optional
    and can be ignored or omitted.
    
    Most of the case statements do check whether the number of remaining
    bits is enough to unpack a value, so let's leave the final decicion
    up to the current handler (pointed by pDescr) if no more bits left.
    
    This is a port of the original patch [1] for OsmoPCU [2].
    
    [1] https://gerrit.osmocom.org/c/osmo-pcu/+/17394
    [2] https://osmocom.org/projects/osmopcu/
    
    Change-Id: If35d62b1cb81e8b2909401684c3b801cb79f1294
    Reviewed-on: https://code.wireshark.org/review/36588
    Reviewed-by: Pau Espin Pedrol <pespin@xxxxxxxxxxx>
    Petri-Dish: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
    

Actions performed:

    from  ac78d86   HiSLIP misc changes
     add  9f1b91a   csn1: fix: do not return 0 if no more bits left in the buffer


Summary of changes:
 epan/dissectors/packet-csn1.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)