Wireshark-commits: [Wireshark-commits] master-1.12 afeff4f: logcat: improve (crash) robustness, imp
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Tue, 12 May 2015 15:38:47 +0000 (UTC)
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=afeff4f5d0c51d2394f7c0f00ae1c57ad8cd1ded
Submitter: Gerald Combs (gerald@xxxxxxxxxxxxx)
Changed: branch: master-1.12
Repository: wireshark

Commits:

afeff4f by Peter Wu (peter@xxxxxxxxxxxxx):

    logcat: improve (crash) robustness, improve names
    
    The logcat version detector would crash with ASAN enabled because it did
    not validate the payload length and hence a payload length of 0 would
    trigger out-of-bounds access. (This happened on non-logcat data.)
    
    This patch tries to get rid of all magic numbers by using a structure,
    improves the version detector to validate the payload length and
    prevents crashes due to missing nul-terminators in the input. Older
    Android kernels would create entries with __pad with random contents, so
    that cannot be used to determine version for v1. Instead, use heuristics
    on the priority, tag and maybe the msg field.
    
    Furthermore, Android is mostly (if not, always?) Little-Endian, so add
    conversions where necessary (just in case WS supports BE arches).
    
    "microseconds" has been renamed to "milliseconds" because that is what
    they are, actually. A duplicate logcat_log loop has been refactored
    such that one loop is sufficient, instead of separate buffers for each
    log part, a single one is now used. get_priority does not really need
    a pointer, just make it accept a character.
    
    The output has been validated against v1 and v2 logcat binary formats
    with __pad (hdr_size) equal to 0, and on attachment 9906.
    
    Reviewed-on: https://code.wireshark.org/review/2803
    Reviewed-by: Michal Labedzki <michal.labedzki@xxxxxxxxx>
    Tested-by: Michal Labedzki <michal.labedzki@xxxxxxxxx>
    (cherry picked from commit b3b1f7c3aa2233a147294bad833b748d38fba84d)
    
    Conflicts:
    	wiretap/logcat.c
    
    Change-Id: I33bb20b5f9a5e03a231121a784bfffdfba0aba98
    Reviewed-on: https://code.wireshark.org/review/8346
    Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
    

Actions performed:

    from  ab74ebd   Fix Diameter reassembly when the captured tvb length is less than 5 bytes.
    adds  afeff4f   logcat: improve (crash) robustness, improve names


Summary of changes:
 wiretap/logcat.c |  270 +++++++++++++++++++++++++++++++++---------------------
 1 file changed, 167 insertions(+), 103 deletions(-)