forked from osmocom/wireshark
Don't cast to a too-large size.
The maximum record length is 255*128 + 127 = 32767; that fits in a guint32, which is large enough to support the biggest packet we'd ever support without stretching several size values to 64 bits. It's not a size of an object in memory, so it doesn't have to be a size_t, and a size_t could be too large to fit in the record sizes we're using. Just cast to guint32. Change-Id: Ie664fda3ce9945893fd992bbb9a81a5d632a3fcb Reviewed-on: https://code.wireshark.org/review/20479 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
fe285c640b
commit
c2e74c5fc2
|
@ -856,7 +856,7 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
|
|||
#define nspr_getv10recordsize(hdp) (pletoh16(&(hdp)->nsprRecordSize))
|
||||
#define nspr_getv20recordtype(hdp) ((hdp)->phd_RecordType)
|
||||
#define nspr_getv20recordsize(hdp) \
|
||||
(size_t)(((hdp)->phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES)? \
|
||||
(guint32)(((hdp)->phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES)? \
|
||||
(((hdp)->phd_RecordSizeHigh * NSPR_V20RECORDSIZE_2BYTES)+ \
|
||||
((hdp)->phd_RecordSizeLow & ~NSPR_V20RECORDSIZE_2BYTES)) : \
|
||||
(hdp)->phd_RecordSizeLow)
|
||||
|
|
Loading…
Reference in New Issue