Idempotent loop
V1044 Loop break conditions do not depend on the number of iterations. mimemoz2.cpp 1795
void ResetChannelCharset(MimeObject *obj) { .... if (cSet) { char *ptr2 = cSet; while ((*cSet) && (*cSet != ' ') && (*cSet != ';') && (*cSet != '\r') && (*cSet != '\n') && (*cSet != '"')) ptr2++; if (*cSet) { PR_FREEIF(obj->options->default_charset); obj->options->default_charset = strdup(cSet); obj->options->override_charset = true; } PR_FREEIF(cSet); } .... }
This error is found using a new diagnostic that will be available in the next analyzer release. All variables used in the while loop’s condition don’t change, as variables ptr2 and cSet are confused in the body of the function.
Please click here to see more bugs from this project.