Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Fix signed overflow

From: Michael Mann <mmann78@xxxxxxxxxxxx>
Date: Thu, 11 Feb 2016 10:33:13 -0500
Your patch has already been included:
https://code.wireshark.org/review/13896
 
 
 
-----Original Message-----
From: Michael McConville <mmcco@xxxxxxxxxxx>
To: wireshark-dev <wireshark-dev@xxxxxxxxxxxxx>
Sent: Thu, Feb 11, 2016 10:24 am
Subject: [Wireshark-dev] Fix signed overflow

Signed overflow is undefined, so the overflow check below is technically
meaningless. Because we're only checking whether an increment will
overflow, we can compare j to G_MAXINT instead.

Thanks for your time,
Michael


diff --git a/wiretap/merge.c b/wiretap/merge.c
index 19c11cd..06dc5db 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -148,7 +148,7 @@ merge_open_in_files(int in_file_count, const char *const *in_file_names,
}
size = wtap_file_size(files[i].wth, err);
if (size == -1) {
- for (j = 0; j + 1 > j && j <= i; j++)
+ for (j = 0; j != G_MAXINT && j <= i; j++)
cleanup_in_file(&files[j]);
*err_fileno = i;
return FALSE;
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe