geoip: never try to store more locations than possible (Coverity 1038517)

pull/552/head
Victor Julien 12 years ago
parent 3cf3b485f2
commit 51c6a333d9

@ -268,6 +268,12 @@ static DetectGeoipData *DetectGeoipDataParse (char *str)
geoipdata->flags |= GEOIP_MATCH_NEGATED;
prevpos++; /* dot not copy the ! */
}
if (geoipdata->nlocations >= GEOOPTION_MAXLOCATIONS) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "too many arguements for geoip keyword");
goto error;
}
if (pos-prevpos > GEOOPTION_MAXSIZE)
strlcpy((char *)geoipdata->location[geoipdata->nlocations], &str[prevpos],
GEOOPTION_MAXSIZE);

Loading…
Cancel
Save