forked from osmocom/wireshark
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>
This commit is contained in:
parent
7b88834869
commit
5cffcf20b1
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue