forked from github/server
CID 22514: Out-of-bounds read (OVERRUN)
This commit is contained in:
parent
0da10ea490
commit
a91a0f6a53
1 changed files with 4 additions and 3 deletions
|
@ -169,12 +169,13 @@ void piracy_cmd(unit * u, order *ord)
|
||||||
if (saff != 0) {
|
if (saff != 0) {
|
||||||
saff = rng_int() % saff;
|
saff = rng_int() % saff;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
||||||
if (saff < aff[dir].value)
|
if (saff < aff[dir].value) {
|
||||||
|
target_dir = dir;
|
||||||
|
a_add(&r->attribs, mk_piracy(u->faction, aff[dir].target, target_dir));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
saff -= aff[dir].value;
|
saff -= aff[dir].value;
|
||||||
}
|
}
|
||||||
target_dir = dir;
|
|
||||||
a_add(&r->attribs, mk_piracy(u->faction, aff[dir].target, target_dir));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue