summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSierraffinity <sierra@domoreaweso.me>2020-12-26 17:47:36 -0800
committerSierraffinity <sierra@domoreaweso.me>2020-12-26 17:47:36 -0800
commitbafbf9240d0f91ee3c38ca4652e3c54b9c503c9b (patch)
tree0182e62373191694f57f5f398f17f41803b96866
parent86fdd033c62d54d679f2c28b5f446e2ef2df7e3e (diff)
Add UBFIX for null deref in sub_80D08CC
-rw-r--r--src/pokemon_storage_system.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index db8f3d2bb..4be1cf729 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -8408,8 +8408,13 @@ static void sub_80D08CC(void)
for (j = sMoveMonsPtr->minRow; j < rowCount; j++)
{
struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition);
-
+ // UB: possible null dereference
+#ifdef UBFIX
+ if (boxMon != NULL)
+ sMoveMonsPtr->boxMons[monArrayId] = *boxMon;
+#else
sMoveMonsPtr->boxMons[monArrayId] = *boxMon;
+#endif
monArrayId++;
boxPosition++;
}