|
@@ -0,0 +1,49 @@
|
|
1
|
+diff -rupN libevhtp-1.2.9.orig/htparse/htparse.c libevhtp-1.2.9/htparse/htparse.c
|
|
2
|
+--- libevhtp-1.2.9.orig/htparse/htparse.c 2014-03-23 12:50:50.000000000 +0100
|
|
3
|
++++ libevhtp-1.2.9/htparse/htparse.c 2014-12-09 01:12:22.242001241 +0100
|
|
4
|
+@@ -197,6 +197,7 @@ static const char * method_strmap[] = {
|
|
5
|
+
|
|
6
|
+ #define _MIN_READ(a, b) ((a) < (b) ? (a) : (b))
|
|
7
|
+
|
|
8
|
++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
9
|
+ #define _str3_cmp(m, c0, c1, c2, c3) \
|
|
10
|
+ *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
|
|
11
|
+
|
|
12
|
+@@ -226,6 +227,37 @@ static const char * method_strmap[] = {
|
|
13
|
+ *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
|
|
14
|
+ && ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
|
|
15
|
+ && m[8] == c8
|
|
16
|
++#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
17
|
++#define _str3_cmp(m, c0, c1, c2, c3) \
|
|
18
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
|
|
19
|
++
|
|
20
|
++#define _str3Ocmp(m, c0, c1, c2, c3) \
|
|
21
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
|
|
22
|
++
|
|
23
|
++#define _str4cmp(m, c0, c1, c2, c3) \
|
|
24
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
|
|
25
|
++
|
|
26
|
++#define _str5cmp(m, c0, c1, c2, c3, c4) \
|
|
27
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
|
|
28
|
++ && m[4] == c4
|
|
29
|
++
|
|
30
|
++#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
|
|
31
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
|
|
32
|
++ && (((uint32_t *)m)[1] & 0xffff0000) == ((c4 << 24) | c5 << 16)
|
|
33
|
++
|
|
34
|
++#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
|
|
35
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
|
|
36
|
++ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
|
|
37
|
++
|
|
38
|
++#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
|
|
39
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
|
|
40
|
++ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
|
|
41
|
++
|
|
42
|
++#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
|
|
43
|
++ *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
|
|
44
|
++ && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7) \
|
|
45
|
++ && m[8] == c8
|
|
46
|
++#endif
|
|
47
|
+
|
|
48
|
+ #define __HTPARSE_GENHOOK(__n) \
|
|
49
|
+ static inline int hook_ ## __n ## _run(htparser * p, htparse_hooks * hooks) { \
|