diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-07-21 18:37:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-07-21 18:37:01 +0000 |
commit | 1da49c28995f0438bcf3be128752c1b6c6e96b87 (patch) | |
tree | 407adc51d5b2230d48e072fa369ee2fb9e1d887d /wiretap/netmon.c | |
parent | 45c49c957fb914c667e470f8f523ed4b7446d4b9 (diff) |
The 32-bit unsigned time offset in version 1.x files should be converted
to a gint64 (which won't sign-extend it) before multiplying by 1000, so
that the product is 64-bit and won't overflow.
svn path=/trunk/; revision=33609
Diffstat (limited to 'wiretap/netmon.c')
-rw-r--r-- | wiretap/netmon.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 761b7afbc0..7bf00f7eae 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -521,8 +521,12 @@ again: * It's 32 bits, so the maximum value will fit in * a gint64 such as delta, even after multiplying * it by 1000. + * + * pletohl() returns a guint32; we cast it to gint64 + * before multiplying, so that the product doesn't + * overflow a guint32. */ - delta = ((guint32)pletohl(&hdr.hdr_1_x.ts_delta))*1000; + delta = ((gint64)pletohl(&hdr.hdr_1_x.ts_delta))*1000; break; case 2: |