Skip to content

Commit e313bed

Browse files
committed
added .clangd, fixed symexp_solve bug
1 parent f6b86c2 commit e313bed

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

.clangd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CompileFlags:
2+
Add: [-xc, -O3, -Wall]
3+
Compiler: clang
4+
5+
Diagnostics:
6+
ClangTidy:
7+
Add: [bugprone-*, cert-*, modernize-*, performance-*]
8+
FastCheckFilter: None

src/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <string.h> // memcpy()
55
#ifndef COMPACT
6-
#include <mach/mach_error.h> // mach_error_string()
6+
#include <mach/mach_error.h> // mach_error_string()
77
#endif
88

99
int read_mem(void *destination, const void *source, size_t len) {

src/private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#ifdef COMPACT
2020
#define LOG_ERROR(fmt, ...) ((void)0)
2121
#else
22-
#include <printf.h> // fprintf()
23-
#define LOG_ERROR(fmt, ...) fprintf(stderr, "ERROR [%s:%d]: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__)
22+
#include <printf.h> // fprintf()
23+
#define LOG_ERROR(fmt, ...) (void)fprintf(stderr, "ERROR [%s:%d]: " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__)
2424
#endif
2525

2626
#define MB (1ll << 20)

src/symsolve/symexport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void *symexp_solve(uint32_t image_index, const char *symbol_name) {
105105
symbol_address = trie_query(export_offset, symbol_name);
106106

107107
if (symbol_address != NULL) {
108-
symbol_address += image_slide;
108+
symbol_address += (uint64_t)mh_header;
109109
}
110110
else {
111111
LOG_ERROR("symexp_solve: symbol not found!");

src/tinyhook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdint.h>
55
#include <string.h> // memcpy()
66
#ifndef COMPACT
7-
#include <mach/mach_error.h> // mach_error_string()
7+
#include <mach/mach_error.h> // mach_error_string()
88
#endif
99

1010
#ifdef __x86_64__

0 commit comments

Comments
 (0)