From 1da49c28995f0438bcf3be128752c1b6c6e96b87 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 21 Jul 2010 18:37:01 +0000 Subject: 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 --- wiretap/netmon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'wiretap/netmon.c') 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: -- cgit v1.2.3