forked from github/server
coverity scan CID 22516: out-of-bounds write
potentially a bug with bad XML files? only matters if we have those, but we shouldn't
This commit is contained in:
parent
8b92003fff
commit
2372d3aacd
|
@ -1815,23 +1815,26 @@ static int parse_races(xmlDocPtr doc)
|
|||
if (result->nodesetval->nodeNr > MAXMAGIETYP) {
|
||||
log_error("race %s has %d potential familiars", rc->_name, result->nodesetval->nodeNr);
|
||||
}
|
||||
for (k = 0; k != MAXMAGIETYP; ++k) {
|
||||
if (k < result->nodesetval->nodeNr) {
|
||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||
else {
|
||||
for (k = 0; k != MAXMAGIETYP; ++k) {
|
||||
if (k < result->nodesetval->nodeNr) {
|
||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||
|
||||
propValue = xmlGetProp(node, BAD_CAST "race");
|
||||
assert(propValue != NULL);
|
||||
frc = rc_get_or_create((const char *)propValue);
|
||||
if (xml_bvalue(node, "default", false)) {
|
||||
rc->familiars[k] = rc->familiars[0];
|
||||
rc->familiars[0] = frc;
|
||||
propValue = xmlGetProp(node, BAD_CAST "race");
|
||||
assert(propValue != NULL);
|
||||
frc = rc_get_or_create((const char *)propValue);
|
||||
if (xml_bvalue(node, "default", false)) {
|
||||
rc->familiars[k] = rc->familiars[0];
|
||||
rc->familiars[0] = frc;
|
||||
}
|
||||
else {
|
||||
rc->familiars[k] = frc;
|
||||
}
|
||||
xmlFree(propValue);
|
||||
}
|
||||
else {
|
||||
rc->familiars[k] = frc;
|
||||
}
|
||||
xmlFree(propValue);
|
||||
} else {
|
||||
rc->familiars[k] = frc;
|
||||
}
|
||||
}
|
||||
xmlXPathFreeObject(result);
|
||||
|
|
Loading…
Reference in New Issue