diff options
author | Michael McConville <mmcco@mykolab.com> | 2016-02-10 19:29:18 -0500 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-02-11 01:39:48 +0000 |
commit | 5cffcf20b147ac88d58774ccce0b76db4704b329 (patch) | |
tree | 51cc91a151462431bb14afc9b75c28ab3668be95 /wiretap/merge.c | |
parent | 7b8883486907cd74a0fc5d2865114b88c3318334 (diff) | |
download | wireshark-5cffcf20b147ac88d58774ccce0b76db4704b329.tar.gz |
Avoid undefined behavior in overflow check
Signed overflow is undefined, so testing for overflow with
"if (i + 1 < i)" is itself undefined. Because this instance is an
increment, we can just test against G_MAXINT.
Change-Id: Ib8b7c23ec362d5637125fcf6457ea9423fedf0e1
Reviewed-on: https://code.wireshark.org/review/13896
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/merge.c')
-rw-r--r-- | wiretap/merge.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c index 19c11cd577..06dc5db617 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; |