afs: correctly calulate padding for strings

length+value strings in AFS are padded to a multiple of 4 octets.
A bug caused the dissector to add an extra 4-octet pad when no padding
was required.  This causes any field after the string to be
mis-dissected, resulting in a false alarm "Malformed packet".

Correct the padding logic to eliminate the false alarm.

Change-Id: I2edc58f20830c2df99d87cdd7d0cbf3bc9b92991
Reviewed-on: https://code.wireshark.org/review/36297
Reviewed-by: Tomasz Moń <desowin@gmail.com>
Petri-Dish: Tomasz Moń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
This commit is contained in:
Mark Vitale 2019-12-18 16:31:23 -05:00 committed by Pascal Quantin
parent e8d770f3c7
commit 77d2bf81a7
1 changed files with 2 additions and 1 deletions

View File

@ -539,7 +539,8 @@ static void OUT_RXString(ptvcursor_t *cursor, int field)
new_offset = ptvcursor_current_offset(cursor);
/* strings are padded to 32-bit boundary */
ptvcursor_advance(cursor, 4-((new_offset-offset)&3));
if ((new_offset-offset)&3)
ptvcursor_advance(cursor, 4-((new_offset-offset)&3));
}
/* Output a fixed length vectorized string (each char is a 32 bit int) */