Wireshark-commits: [Wireshark-commits] master-3.0 c6f6425: Fix the test for a NetScaler trace file.

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

Commits:

c6f6425 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 08a7fc6b8d724b9bc0d81f73e9346736645ef1d2)
    Reviewed-on: https://code.wireshark.org/review/32404
    

Actions performed:

    from  f80b7d1   gsm_gsup: check the current len against the caller length.
     add  c6f6425   Fix the test for a NetScaler trace file.


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