From: Christophe Jaillet Date: Mon, 15 Oct 2012 19:53:22 +0000 (+0000) Subject: cppcheck: arrayIndexThenCheck - change the order of the tests in order to avoid a X-Git-Tag: 2.5.0-alpha~6194 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0def67cc8100a8364f26d5b857f803607698ef39;p=thirdparty%2Fapache%2Fhttpd.git cppcheck: arrayIndexThenCheck - change the order of the tests in order to avoid a potential out-of-bound access. I think that this module is obsolete, but doing so reduces the noise in cppcheck output... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1398480 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/mappers/mod_imagemap.c b/modules/mappers/mod_imagemap.c index d7b01dd665c..19db1511cb6 100644 --- a/modules/mappers/mod_imagemap.c +++ b/modules/mappers/mod_imagemap.c @@ -176,7 +176,7 @@ static int pointinpoly(const double point[2], double pgon[MAXVERTS][2]) int i, numverts, crossings = 0; double x = point[X], y = point[Y]; - for (numverts = 0; pgon[numverts][X] != -1 && numverts < MAXVERTS; + for (numverts = 0; numverts < MAXVERTS && pgon[numverts][X] != -1; numverts++) { /* just counting the vertexes */ }