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.

35 lines
1.3 KiB

  1. From 0dff81c6a5876172bc1d4725a7a07fddd9d1f369 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Tue, 15 Jul 2014 21:34:06 +0200
  4. Subject: [PATCH 4/5] BUG/MINOR: http: base32+src should use the big endian
  5. version of base32
  6. We're using the internal memory representation of base32 here, which is
  7. wrong since these data might be exported to headers for logs or be used
  8. to stick to a server and replicated to other peers. Let's convert base32
  9. to big endian (network representation) when building the binary block.
  10. This mistake is also present in 1.5, it would be better to backport it.
  11. (cherry picked from commit 5ad6e1dc09f0a85aabf86f154b1817b9ebffb568)
  12. ---
  13. src/proto_http.c | 4 ++--
  14. 1 file changed, 2 insertions(+), 2 deletions(-)
  15. diff --git a/src/proto_http.c b/src/proto_http.c
  16. index 94afed7..b7ed85d 100644
  17. --- a/src/proto_http.c
  18. +++ b/src/proto_http.c
  19. @@ -10358,8 +10358,8 @@ smp_fetch_base32_src(struct proxy *px, struct session *l4, void *l7, unsigned in
  20. return 0;
  21. temp = get_trash_chunk();
  22. - memcpy(temp->str + temp->len, &smp->data.uint, sizeof(smp->data.uint));
  23. - temp->len += sizeof(smp->data.uint);
  24. + *(unsigned int *)temp->str = htonl(smp->data.uint);
  25. + temp->len += sizeof(unsigned int);
  26. switch (cli_conn->addr.from.ss_family) {
  27. case AF_INET:
  28. --
  29. 1.8.5.5