Skip to content

Commit

Permalink
add out of bounds checks
Browse files Browse the repository at this point in the history
  • Loading branch information
carxt committed Jun 17, 2023
1 parent 636fe01 commit aef8f17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions JG/functions/fn_dial.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool Cmd_DialogResponseAddRelatedTopic_Execute(COMMAND_ARGS) {
TESTopic* topic = NULL;
UInt32 responseType = -1;
SInt32 addPosition = 0;
if (ExtractArgsEx(EXTRACT_ARGS_EX, &dialogResponse, &topic, &responseType, &addPosition) && IS_TYPE(dialogResponse, TESTopicInfo)) {
if (ExtractArgsEx(EXTRACT_ARGS_EX, &dialogResponse, &topic, &responseType, &addPosition) && IS_TYPE(dialogResponse, TESTopicInfo) && responseType >= ResponseRelatedTopicType::kRelatedTopicType_LinkFrom && responseType <= ResponseRelatedTopicType::kRelatedTopicType_FollowUp) {
if (!dialogResponse->relatedTopics) {
//initializer for the relatedTopics structure.
dialogResponse->relatedTopics = ThisStdCall<TESTopicInfo::RelatedTopics*>(0x061CE40, GameHeapAlloc(sizeof(TESTopicInfo::RelatedTopics)));
Expand All @@ -61,7 +61,7 @@ bool Cmd_DialogResponseRelatedGetAll_Execute(COMMAND_ARGS) {
UInt32 responseType = -1;
NVSEArrayVar* topicArr = g_arrInterface->CreateArray(NULL, 0, scriptObj);

if (ExtractArgsEx(EXTRACT_ARGS_EX, &dialogResponse, &responseType) && IS_TYPE(dialogResponse, TESTopicInfo)) {
if (ExtractArgsEx(EXTRACT_ARGS_EX, &dialogResponse, &responseType) && IS_TYPE(dialogResponse, TESTopicInfo)&&responseType >= ResponseRelatedTopicType::kRelatedTopicType_LinkFrom && responseType <= ResponseRelatedTopicType::kRelatedTopicType_FollowUp) {
TESTopicInfo::RelatedTopics* relTopics = dialogResponse->relatedTopics;
if (relTopics) {
auto addToArray = [topicArr](tList<TESTopic>::Iterator iter) -> void {
Expand Down

0 comments on commit aef8f17

Please sign in to comment.