]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: b_rew() must pass a signed offset to b_ptr()
authorWilly Tarreau <w@1wt.eu>
Thu, 31 May 2012 09:33:42 +0000 (11:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 31 May 2012 09:33:42 +0000 (11:33 +0200)
Commit 13e66da introduced b_rew() but passes -adv which is an unsigned
quantity on 64-bit platforms, causing the buffer to advance in the wrong
direction.

No backport is needed.

include/proto/buffers.h

index 66c6e61782b6b7ea28f9ec967a1f6dc4016eea64..80f43ae4a694da92109090ae3a9175fd2e026f05 100644 (file)
@@ -313,7 +313,7 @@ static inline void b_rew(struct buffer *b, unsigned int adv)
        b->o -= adv;
        if (!b->o && !b->pipe)
                b->flags |= BF_OUT_EMPTY;
-       b->p = b_ptr(b, -adv);
+       b->p = b_ptr(b, (int)-adv);
 }
 
 /* Return the amount of bytes that can be written into the buffer at once,