Wireshark mailing list archives
Fix signed overflow
From: Michael McConville <mmcco () mykolab com>
Date: Wed, 10 Feb 2016 10:46:02 -0500
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 () wireshark org>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Fix signed overflow Michael McConville (Feb 11)
- Re: Fix signed overflow Michael Mann (Feb 11)
- Re: Fix signed overflow Guy Harris (Feb 11)
- Re: Fix signed overflow Kevin Cox (Feb 11)
- Re: Fix signed overflow Michael Mann (Feb 11)
