add bounds checking to /area and evidence
This commit is contained in:
parent
483e89d5cf
commit
7d87a7027f
@ -641,7 +641,7 @@ void AOClient::cmdArea(int argc, QStringList argv)
|
|||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
int new_area = argv[0].toInt(&ok);
|
int new_area = argv[0].toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok || new_area > server->areas.size() || new_area < 0) {
|
||||||
sendServerMessage("That does not look like a valid area ID.");
|
sendServerMessage("That does not look like a valid area ID.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ void AOClient::pktRemoveEvidence(AreaData* area, int argc, QStringList argv, AOP
|
|||||||
{
|
{
|
||||||
bool is_int = false;
|
bool is_int = false;
|
||||||
int idx = argv[0].toInt(&is_int);
|
int idx = argv[0].toInt(&is_int);
|
||||||
if (is_int) {
|
if (is_int && idx <= area->evidence.size() && idx >= 0) {
|
||||||
area->evidence.removeAt(idx);
|
area->evidence.removeAt(idx);
|
||||||
}
|
}
|
||||||
sendEvidenceList(area);
|
sendEvidenceList(area);
|
||||||
@ -300,7 +300,7 @@ void AOClient::pktEditEvidence(AreaData* area, int argc, QStringList argv, AOPac
|
|||||||
bool is_int = false;
|
bool is_int = false;
|
||||||
int idx = argv[0].toInt(&is_int);
|
int idx = argv[0].toInt(&is_int);
|
||||||
AreaData::Evidence evi = {argv[1], argv[2], argv[3]};
|
AreaData::Evidence evi = {argv[1], argv[2], argv[3]};
|
||||||
if (is_int) {
|
if (is_int && idx <= area->evidence.size() && idx >= 0) {
|
||||||
area->evidence.replace(idx, evi);
|
area->evidence.replace(idx, evi);
|
||||||
}
|
}
|
||||||
sendEvidenceList(area);
|
sendEvidenceList(area);
|
||||||
|
Loading…
Reference in New Issue
Block a user