You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.3 KiB

  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. #define _MIN_READ(a, b) ((a) < (b) ? (a) : (b))
  6. +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  7. #define _str3_cmp(m, c0, c1, c2, c3) \
  8. *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
  9. @@ -226,6 +227,37 @@ static const char * method_strmap[] = {
  10. *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
  11. && ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
  12. && m[8] == c8
  13. +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  14. +#define _str3_cmp(m, c0, c1, c2, c3) \
  15. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
  16. +
  17. +#define _str3Ocmp(m, c0, c1, c2, c3) \
  18. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
  19. +
  20. +#define _str4cmp(m, c0, c1, c2, c3) \
  21. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
  22. +
  23. +#define _str5cmp(m, c0, c1, c2, c3, c4) \
  24. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
  25. + && m[4] == c4
  26. +
  27. +#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
  28. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
  29. + && (((uint32_t *)m)[1] & 0xffff0000) == ((c4 << 24) | c5 << 16)
  30. +
  31. +#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
  32. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
  33. + && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
  34. +
  35. +#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
  36. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
  37. + && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
  38. +
  39. +#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
  40. + *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
  41. + && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7) \
  42. + && m[8] == c8
  43. +#endif
  44. #define __HTPARSE_GENHOOK(__n) \
  45. static inline int hook_ ## __n ## _run(htparser * p, htparse_hooks * hooks) { \