Skip to content

Commit

Permalink
Update fishhook with nullptr dereference fix
Browse files Browse the repository at this point in the history
  • Loading branch information
megCanicalKb committed Apr 2, 2018
1 parent 4a3d46c commit bb16132
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rcd_fishhook/rcd_fishhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ int rcd_rebind_symbols_image(void *header,
struct rcd_rebindings_entry *rebindings_head = NULL;
int retval = rcd_prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);
rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide);
if (rebindings_head->rebindings) {
if (rebindings_head) {
free(rebindings_head->rebindings);
}
free(rebindings_head);
Expand Down
33 changes: 33 additions & 0 deletions update_fishhook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

set -x
set -e

cd -- "$(dirname -- "$0")"

# Download data in temp dir.
rcd_fishhook_path="$(pwd)/rcd_fishhook/"
git_fishhook_path=$(mktemp -d /tmp/rcd-fishhook.XXXXXX)
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file, exiting..."
exit 1
fi
cd -- "$git_fishhook_path"
git clone '[email protected]:facebook/fishhook.git'

# Update repo.
cd "${rcd_fishhook_path}"
rm -- rcd_fishhook.* || true
cp -r "${git_fishhook_path}"/fishhook/* .
rm fishhook.podspec

sed -i '' 's/fishhook_h/rcd_fishhook_h/g' fishhook.*
sed -i '' 's/fishhook\.h/rcd_fishhook\.h/g' fishhook.*
sed -i '' 's/struct rebinding/struct rcd_rebinding/g' fishhook.*
sed -E -i '' 's/(rebind_symbols(_image)?|prepend_rebindings|perform_rebinding_with_section)\(/rcd_\1\(/g' fishhook.*

mv fishhook.h rcd_fishhook.h
mv fishhook.c rcd_fishhook.c

# Clean up.
rm -rf "$git_fishhook"

0 comments on commit bb16132

Please sign in to comment.