Fix last argument in calls to dCamera_c::startEventCamera

The last argument is used as a char*, so we need to explicitly
pass nullptr instead of 0 to ensure it has the correct type.
This was causing crashes due to va_arg reading 8 bytes when only 4
were provided by the caller - if the out-of-bounds bytes are
non-zero, the null check fails and it continues pulling args from
beyond the argument buffer potentially triggering a segfault.
This commit is contained in:
Max Roncace
2026-03-20 02:51:29 -04:00
parent 91d8e422ac
commit 7ae18f3a9d
10 changed files with 17 additions and 17 deletions
+3 -3
View File
@@ -379,7 +379,7 @@ int daAlink_c::procBottleDrinkInit(u16 i_itemNo) {
mProcVar0.field_0x3008 = 0;
u32 id = fopAcM_GetID(this);
dCam_getBody()->StartEventCamera(0x12, id, "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x12, id, "Type", 1, &field_0x3194, nullptr);
mProcVar2.field_0x300c = 0;
mProcVar3.field_0x300e = 0;
return 1;
@@ -429,7 +429,7 @@ int daAlink_c::procBottleOpenInit(u16 i_itemNo) {
mProcVar3.field_0x300e = 0;
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, nullptr);
mProcVar2.field_0x300c = 0;
field_0x27c8.initialize(current.pos.y + mHeight);
@@ -738,7 +738,7 @@ int daAlink_c::procBottleGetInit(BOOL param_0) {
}
u32 id = fopAcM_GetID(this);
dCam_getBody()->StartEventCamera(0x12, id, "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x12, id, "Type", 1, &field_0x3194, nullptr);
if (mEquipItem == dItemNo_FAIRY_DROP_e || mEquipItem == dItemNo_CHUCHU_RARE_e || mEquipItem == dItemNo_WORM_e) {
setFaceBasicTexture(FTANM_I_BINGET);
+1 -1
View File
@@ -1575,7 +1575,7 @@ int daAlink_c::procCanoeBottleDrinkInit(u16 i_itemNo) {
dComIfGp_setPlayerStatus1(0, 0x2000);
field_0x319c = 1;
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x319c, 0);
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x319c, nullptr);
mProcVar2.field_0x300c = 0;
return 1;
}
+2 -2
View File
@@ -1982,7 +1982,7 @@ int daAlink_c::procCoLavaReturnInit(BOOL i_isSandReturn) {
mNormalSpeed = 0.0f;
field_0x3194 = 1;
dCam_getBody()->StartEventCamera(9, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(9, fopAcM_GetID(this), "Type", 1, &field_0x3194, nullptr);
return 1;
}
@@ -2040,7 +2040,7 @@ int daAlink_c::procCoSwimFreezeReturnInit() {
field_0x3194 = 1;
u32 id = fopAcM_GetID(this);
dCam_getBody()->StartEventCamera(9, id, "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(9, id, "Type", 1, &field_0x3194, nullptr);
mProcVar2.field_0x300c = 0x2D;
return 1;
}
+3 -3
View File
@@ -3019,7 +3019,7 @@ int daAlink_c::procCoDead() {
if (!checkNoResetFlg2(FLG2_FORCE_GAMEOVER)) {
mProcVar3.field_0x300e++;
if (mProcVar3.field_0x300e == 2) {
dCam_getBody()->StartEventCamera(9, fopAcM_GetID(this), 0);
dCam_getBody()->StartEventCamera(9, fopAcM_GetID(this), nullptr);
} else if (mProcVar3.field_0x300e > 10) {
mProcVar3.field_0x300e = 10;
}
@@ -3330,7 +3330,7 @@ int daAlink_c::procCoFogDeadInit() {
field_0x3194 = 0;
dCam_getBody()->StartEventCamera(0x13, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x13, fopAcM_GetID(this), "Type", 1, &field_0x3194, nullptr);
mProcVar0.field_0x3008 = 60;
mProcVar2.field_0x300c = 0;
return 1;
@@ -3849,7 +3849,7 @@ int daAlink_c::procNotUseItemInit(int i_itemNo) {
current.angle.y = shape_angle.y;
field_0x3194 = 3;
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, nullptr);
keepItemData();
dComIfGp_setPlayerStatus1(0, 0x4000800);
+1 -1
View File
@@ -2570,7 +2570,7 @@ int daAlink_c::procHorseBottleDrinkInit(u16 i_itemNo) {
dComIfGp_setPlayerStatus1(0, 0x2000);
field_0x319c = 1;
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x319c, 0);
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x319c, nullptr);
mProcVar2.field_0x300c = 0;
return 1;
}
+1 -1
View File
@@ -256,7 +256,7 @@ void daAlink_c::commonKandelaarPourInit() {
mProcVar2.field_0x300c = 0;
dComIfGp_setPlayerStatus1(0, 0x2000);
field_0x3194 = 10;
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, 0);
dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", 1, &field_0x3194, nullptr);
}
int daAlink_c::commonKandelaarPour(int param_0) {
+1 -1
View File
@@ -145,7 +145,7 @@ int daAlink_c::procGrassWhistleWaitInit(int param_0, int param_1, int param_2, s
mProcVar2.field_0x300c = param_0;
mProcVar3.field_0x300e = param_1;
dCam_getBody()->StartEventCamera(12, fopAcM_GetID(this), 0);
dCam_getBody()->StartEventCamera(12, fopAcM_GetID(this), nullptr);
mProcVar0.field_0x3008 = 0;
mProcVar4.field_0x3010 = 0;
mProcVar5.field_0x3012 = 0;
+3 -3
View File
@@ -3967,7 +3967,7 @@ int daAlink_c::procWolfHowlDemoInit() {
}
}
dCam_getBody()->StartEventCamera(12, fopAcM_GetID(this), 0);
dCam_getBody()->StartEventCamera(12, fopAcM_GetID(this), nullptr);
mProcVar1.field_0x300a = 0;
mMsgClassID = fpcM_ERROR_PROCESS_ID_e;
field_0x32cc = 0x5DD;
@@ -9206,7 +9206,7 @@ int daAlink_c::procWolfDigThroughInit(int param_0) {
field_0x3198 = 3;
}
dCam_getBody()->StartEventCamera(0x1E, fopAcM_GetID(this), "Type", 1, &field_0x3198, 0);
dCam_getBody()->StartEventCamera(0x1E, fopAcM_GetID(this), "Type", 1, &field_0x3198, nullptr);
cXyz sp8(current.pos.x, 30.0f + field_0x27f4->current.pos.y, current.pos.z);
if (fopAcM_gc_c::gndCheck(&sp8)) {
@@ -9413,7 +9413,7 @@ int daAlink_c::procWolfGetSmell() {
mProcVar4.field_0x3010 = 1;
dCam_getBody()->StartEventCamera(8, fopAcM_GetID(this), 0);
dCam_getBody()->StartEventCamera(8, fopAcM_GetID(this), nullptr);
field_0x2f99 = 12;
if (field_0x3198 == 0xBBC) {
+1 -1
View File
@@ -577,7 +577,7 @@ void daNpcTkc_c::reset() {
setAngle(fopAcM_searchPlayerAngleY(this));
static int const m_cameraItemNum = 1;
dCam_getBody()->StartEventCamera(18, fopAcM_GetID(this), "Type", 1, &m_cameraItemNum, 0);
dCam_getBody()->StartEventCamera(18, fopAcM_GetID(this), "Type", 1, &m_cameraItemNum, nullptr);
} else if (parentActorID == fpcM_ERROR_PROCESS_ID_e) {
home.pos.y += mpHIO->m.target_height;
} else {
+1 -1
View File
@@ -164,7 +164,7 @@ int daObjTks_c::Create() {
field_0xde1 = 1;
static const int m_cameraItemNum = 1;
dCam_getBody()->StartEventCamera(18, fopAcM_GetID(this), "Type", 1, &m_cameraItemNum, 0);
dCam_getBody()->StartEventCamera(18, fopAcM_GetID(this), "Type", 1, &m_cameraItemNum, nullptr);
}
return phase_state;