From: Willy Tarreau Date: Tue, 15 Jul 2014 19:34:06 +0000 (+0200) Subject: BUG/MINOR: http: base32+src should use the big endian version of base32 X-Git-Tag: v1.6-dev1~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ad6e1dc;p=thirdparty%2Fhaproxy.git BUG/MINOR: http: base32+src should use the big endian version of base32 We're using the internal memory representation of base32 here, which is wrong since these data might be exported to headers for logs or be used to stick to a server and replicated to other peers. Let's convert base32 to big endian (network representation) when building the binary block. This mistake is also present in 1.5, it would be better to backport it. --- diff --git a/src/proto_http.c b/src/proto_http.c index 2017494061..9e50796dcb 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -10358,8 +10358,8 @@ smp_fetch_base32_src(struct proxy *px, struct session *l4, void *l7, unsigned in return 0; temp = get_trash_chunk(); - memcpy(temp->str + temp->len, &smp->data.uint, sizeof(smp->data.uint)); - temp->len += sizeof(smp->data.uint); + *(unsigned int *)temp->str = htonl(smp->data.uint); + temp->len += sizeof(unsigned int); switch (cli_conn->addr.from.ss_family) { case AF_INET: