Fix undefined behavior. With ORCA/C 2.2, this code generates an infinite loop. (essentially, name2[i+1] = toupper(name2[i]))

This commit is contained in:
Kelvin Sherlock 2018-03-11 23:42:01 -04:00
parent 7fbe55dd87
commit a0eaf0f741
1 changed files with 4 additions and 2 deletions

View File

@ -1718,8 +1718,10 @@ if (file) {
while (f) {
strcpy(name2, f->fName);
i = 0;
while (name2[i])
name2[i] = toupper(name2[i++]);
while (name2[i]) {
name2[i] = toupper(name2[i]);
++i;
}
if (! strcmp(name2, name))
return f->fFile;
f = f->fNext;