Wireshark-commits: [Wireshark-commits] master-2.6 89d91d7: Fix the test for a NetScaler trace file.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 14 Mar 2019 10:49:34 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=89d91d7b9cba0c2ba9f8dd6e4af43c5dee3d8522
Submitter: "Guy Harris <guy@xxxxxxxxxxxx>"
Changed: branch: master-2.6
Repository: wireshark

Commits:

89d91d7 by Guy Harris (guy@xxxxxxxxxxxx):

    Fix the test for a NetScaler trace file.
    
    When testing the signature field against a given version's signature:
    
    	we require that the signature field's size (size, not C
    	null-terminated string length) be at least the size of the
    	signature string (otherwise, it can't possibly match);
    
    	we check to make sure that the first N bytes of the signature
    	field, where N is the size of the version's signature string
    	(not including any terminating '\0' in that string), match the
    	version's signature string.
    
    I.e., we require that the version's signature string is a prefix of the
    signature string in the file.
    
    This does not require that the signature string in the file be
    null-terminated.
    
    It also doesn't allow the file's signature string to be a substring of
    the version's signature string, as that's *NOT* sufficient to identify
    the file as a NetScaler trace file, especially if we forcibly
    null-terminate the file's signature string and we trucate it to be
    zero-length, as, in that case, it's *always* a prefix of the version's
    signature string, and the file is incorrectly identified as a NetScaler
    trace file.
    
    (While we're at it, we make the nspm_signature_isvXXX() routines return
    true if it *is* and false if it *isn't*, rather than the reverse; having
    a routine with a name containing "is", and not "isnt", return true if it
    *isn't* is confusing.)
    
    Change-Id: I3694773a71b8b63d280e42f146698c82a0f0c332
    Ping-Bug: 15601
    Reviewed-on: https://code.wireshark.org/review/32403
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    (cherry picked from commit f18bd4bd68e950a22baa9d7d4f1ed9236b410f68)
    Reviewed-on: https://code.wireshark.org/review/32405
    

Actions performed:

    from  65e9fe4   GSM A RR: fix Frequency List Variable Bitmap IE dissection
     add  89d91d7   Fix the test for a NetScaler trace file.


Summary of changes:
 wiretap/netscaler.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)