Skip to content

Commit

Permalink
fixed oob bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tihmstar committed Jan 29, 2021
1 parent 2eb5022 commit 27e0e7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
26 changes: 16 additions & 10 deletions img4tool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
4281CC82234A01C500C30E6D /* libplist.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4281CC81234A01C500C30E6D /* libplist.3.dylib */; };
8754A6B1236F16B600C0D285 /* libgeneral.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8754A6B0236F16B600C0D285 /* libgeneral.0.dylib */; };
8754A6B2236F16B600C0D285 /* libgeneral.0.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 8754A6B0236F16B600C0D285 /* libgeneral.0.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
875585D7238967FA00B90FC9 /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 875585D6238967C500B90FC9 /* libcompression.tbd */; };
8791272A24D0ABA30071283F /* libcrypto.1.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8791272924D0ABA30071283F /* libcrypto.1.1.dylib */; };
8791272B24D0ABA30071283F /* libcrypto.1.1.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 8791272924D0ABA30071283F /* libcrypto.1.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8776E51225C46299002971E6 /* libplist-2.0.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8776E51125C46299002971E6 /* libplist-2.0.3.dylib */; };
8776E51325C46299002971E6 /* libplist-2.0.3.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 8776E51125C46299002971E6 /* libplist-2.0.3.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8776E51525C462B0002971E6 /* libcrypto.1.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8776E51425C462B0002971E6 /* libcrypto.1.1.dylib */; };
8776E51625C462B0002971E6 /* libcrypto.1.1.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 8776E51425C462B0002971E6 /* libcrypto.1.1.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
879896AD2344A91900A98709 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 879896AC2344A91900A98709 /* main.cpp */; };
87A281342347B7B900ED08BB /* ASN1DERElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 87A281322347B7B900ED08BB /* ASN1DERElement.cpp */; };
87A281372347B7CA00ED08BB /* img4tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 87A281352347B7CA00ED08BB /* img4tool.cpp */; };
Expand All @@ -27,7 +28,8 @@
dstSubfolderSpec = 10;
files = (
8754A6B2236F16B600C0D285 /* libgeneral.0.dylib in Embed Libraries */,
8791272B24D0ABA30071283F /* libcrypto.1.1.dylib in Embed Libraries */,
8776E51325C46299002971E6 /* libplist-2.0.3.dylib in Embed Libraries */,
8776E51625C462B0002971E6 /* libcrypto.1.1.dylib in Embed Libraries */,
);
name = "Embed Libraries";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -50,6 +52,8 @@
8754A6B0236F16B600C0D285 /* libgeneral.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libgeneral.0.dylib; path = ../../../../usr/local/lib/libgeneral.0.dylib; sourceTree = "<group>"; };
875585D6238967C500B90FC9 /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcompression.tbd; path = usr/lib/libcompression.tbd; sourceTree = SDKROOT; };
8762F342236DDFD400F42FDB /* img4tool.hpp.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = img4tool.hpp.in; path = include/img4tool/img4tool.hpp.in; sourceTree = SOURCE_ROOT; };
8776E51125C46299002971E6 /* libplist-2.0.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libplist-2.0.3.dylib"; path = "../../../../usr/local/lib/libplist-2.0.3.dylib"; sourceTree = "<group>"; };
8776E51425C462B0002971E6 /* libcrypto.1.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.1.1.dylib; path = "../../../../usr/local/Cellar/[email protected]/1.1.1i/lib/libcrypto.1.1.dylib"; sourceTree = "<group>"; };
8791272924D0ABA30071283F /* libcrypto.1.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.1.1.dylib; path = "../../../../usr/local/Cellar/[email protected]/1.1.1g/lib/libcrypto.1.1.dylib"; sourceTree = "<group>"; };
879896A92344A91900A98709 /* img4tool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = img4tool; sourceTree = BUILT_PRODUCTS_DIR; };
879896AC2344A91900A98709 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
Expand All @@ -69,9 +73,9 @@
buildActionMask = 2147483647;
files = (
8754A6B1236F16B600C0D285 /* libgeneral.0.dylib in Frameworks */,
4281CC82234A01C500C30E6D /* libplist.3.dylib in Frameworks */,
875585D7238967FA00B90FC9 /* libcompression.tbd in Frameworks */,
8791272A24D0ABA30071283F /* libcrypto.1.1.dylib in Frameworks */,
8776E51225C46299002971E6 /* libplist-2.0.3.dylib in Frameworks */,
8776E51525C462B0002971E6 /* libcrypto.1.1.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -81,6 +85,8 @@
4281CC80234A01C500C30E6D /* Frameworks */ = {
isa = PBXGroup;
children = (
8776E51425C462B0002971E6 /* libcrypto.1.1.dylib */,
8776E51125C46299002971E6 /* libplist-2.0.3.dylib */,
8791272924D0ABA30071283F /* libcrypto.1.1.dylib */,
87E6A5FD24A75AC70081D457 /* libcrypto.1.0.0.dylib */,
87E6A5FA24A75AA10081D457 /* libssl.1.0.0.dylib */,
Expand Down Expand Up @@ -318,11 +324,11 @@
"$(SRCROOT)/include",
/usr/local/include,
"$(SRCROOT)/include/img4tool",
"/usr/local/Cellar/[email protected]/1.1.1g/include",
"/usr/local/Cellar/[email protected]/1.1.1i/include",
);
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
"/usr/local/Cellar/[email protected]/1.1.1g/lib",
"/usr/local/Cellar/[email protected]/1.1.1i/lib",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -337,11 +343,11 @@
"$(SRCROOT)/include",
/usr/local/include,
"$(SRCROOT)/include/img4tool",
"/usr/local/Cellar/[email protected]/1.1.1g/include",
"/usr/local/Cellar/[email protected]/1.1.1i/include",
);
LIBRARY_SEARCH_PATHS = (
/usr/local/lib,
"/usr/local/Cellar/[email protected]/1.1.1g/lib",
"/usr/local/Cellar/[email protected]/1.1.1i/lib",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down
3 changes: 2 additions & 1 deletion img4tool/img4tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ ASN1DERElement tihmstar::img4tool::appendIM4MToIMG4(const ASN1DERElement &img4,

ASN1DERElement tihmstar::img4tool::uncompressIfNeeded(const ASN1DERElement &compressedOctet, const ASN1DERElement &origIM4P, const char **outUsedCompression, const char **outHypervisor, size_t *outHypervisorSize){
const char *payload = (const char *)compressedOctet.payload();
size_t payloadSize = compressedOctet.size();
size_t payloadSize = compressedOctet.payloadSize();
size_t unpackedLen = 0;
char *unpacked = NULL;
cleanup([&]{
Expand Down Expand Up @@ -620,6 +620,7 @@ ASN1DERElement tihmstar::img4tool::getPayloadFromIM4P(const ASN1DERElement &im4p
if (decryptIv || decryptKey) {
#ifdef HAVE_CRYPTO
payload = decryptPayload(payload, decryptIv, decryptKey);
info("payload decrypted");
#else
reterror("decryption keys were provided, but img4tool was compiled without crypto backend!");
#endif //HAVE_CRYPTO
Expand Down

0 comments on commit 27e0e7f

Please sign in to comment.