forked from acidanthera/AppleALC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapstone.patch
49 lines (44 loc) · 1.36 KB
/
capstone.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
diff -rupN capstone-3.0.4/cs.c capstone/cs.c
--- capstone-3.0.4/cs.c 2015-07-15 10:44:42.000000000 +0300
+++ capstone/cs.c 2016-01-05 17:13:41.000000000 +0300
@@ -280,7 +280,7 @@ static void fill_insn(struct cs_struct *
#ifndef CAPSTONE_DIET
// fill in mnemonic & operands
// find first space or tab
- sp = buffer;
+ // sp = buffer;
mnem = insn->mnemonic;
for (sp = buffer; *sp; sp++) {
if (*sp == ' '|| *sp == '\t')
@@ -392,6 +392,7 @@ cs_err cs_option(csh ud, cs_opt_type typ
static void skipdata_opstr(char *opstr, const uint8_t *buffer, size_t size)
{
char *p = opstr;
+ size_t p_size = sizeof(((struct cs_insn *)NULL)->op_str);
int len;
size_t i;
@@ -400,11 +401,11 @@ static void skipdata_opstr(char *opstr,
return;
}
- len = sprintf(p, "0x%02x", buffer[0]);
+ len = snprintf(p, p_size, "0x%02x", buffer[0]);
p+= len;
for(i = 1; i < size; i++) {
- len = sprintf(p, ", 0x%02x", buffer[i]);
+ len = snprintf(p, p_size, ", 0x%02x", buffer[i]);
p+= len;
}
}
diff -rupN capstone-3.0.4/utils.h capstone/utils.h
--- capstone-3.0.4/utils.h 2015-07-15 10:44:42.000000000 +0300
+++ capstone/utils.h 2016-01-05 17:12:04.000000000 +0300
@@ -4,7 +4,11 @@
#ifndef CS_UTILS_H
#define CS_UTILS_H
+#if defined(CAPSTONE_HAS_OSXKERNEL)
+#include <libkern/libkern.h>
+#else
#include <stddef.h>
+#endif
#include "include/capstone.h"
#include "cs_priv.h"