Skip to content

Commit

Permalink
fix: Potential null dereference in PatcherPlus
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualEhrmanntraut committed Feb 2, 2025
1 parent 04223fb commit 098c0c0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions NootedRed/PatcherPlus.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// Copyright © 2022-2024 ChefKiss. Licensed under the Thou Shalt Not Profit License version 1.5.
// Copyright © 2022-2025 ChefKiss. Licensed under the Thou Shalt Not Profit License version 1.5.
// See LICENSE for details.

#include <PrivateHeaders/PatcherPlus.hpp>

bool SolveRequestPlus::solve(KernelPatcher &patcher, size_t id, mach_vm_address_t address, size_t maxSize) {
PANIC_COND(!this->address, "Patcher+", "this->address is null");

*this->address = patcher.solveSymbol(id, this->symbol);
if (*this->address) { return true; }
patcher.clearError();
if (this->symbol != nullptr) {
*this->address = patcher.solveSymbol(id, this->symbol);
if (*this->address) { return true; }
patcher.clearError();
}

if (!this->pattern || !this->patternSize) {
DBGLOG("Patcher+", "Failed to solve %s using symbol", safeString(this->symbol));
Expand Down Expand Up @@ -36,8 +38,10 @@ bool SolveRequestPlus::solveAll(KernelPatcher &patcher, size_t id, SolveRequestP
}

bool RouteRequestPlus::route(KernelPatcher &patcher, size_t id, mach_vm_address_t address, size_t maxSize) {
if (patcher.routeMultiple(id, this, 1, address, maxSize)) { return true; }
patcher.clearError();
if (this->symbol != nullptr) {
if (patcher.routeMultiple(id, this, 1, address, maxSize)) { return true; }
patcher.clearError();
}

if (!this->pattern || !this->patternSize) {
DBGLOG("Patcher+", "Failed to route %s using symbol", safeString(this->symbol));
Expand Down

0 comments on commit 098c0c0

Please sign in to comment.