mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-02 11:33:21 +00:00
[BUG] buffers: wrong size calculation for displaced data
This error was triggered by requests not starting at the beginning of the buffer. It cannot happen with earlier versions though it might be a good idea to fix it anyway.
This commit is contained in:
parent
83e3af0c86
commit
019fd5bc93
@ -197,7 +197,7 @@ int buffer_replace(struct buffer *b, char *pos, char *end, const char *str)
|
||||
return 0; /* no space left */
|
||||
|
||||
/* first, protect the end of the buffer */
|
||||
memmove(end + delta, end, b->data + b->l - end);
|
||||
memmove(end + delta, end, b->r - end);
|
||||
|
||||
/* now, copy str over pos */
|
||||
memcpy(pos, str,len);
|
||||
@ -237,7 +237,7 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int
|
||||
}
|
||||
|
||||
/* first, protect the end of the buffer */
|
||||
memmove(end + delta, end, b->data + b->l - end);
|
||||
memmove(end + delta, end, b->r - end);
|
||||
|
||||
/* now, copy str over pos */
|
||||
if (len)
|
||||
@ -278,7 +278,7 @@ int buffer_insert_line2(struct buffer *b, char *pos, const char *str, int len)
|
||||
return 0; /* no space left */
|
||||
|
||||
/* first, protect the end of the buffer */
|
||||
memmove(pos + delta, pos, b->data + b->l - pos);
|
||||
memmove(pos + delta, pos, b->r - pos);
|
||||
|
||||
/* now, copy str over pos */
|
||||
if (len && str) {
|
||||
|
Loading…
Reference in New Issue
Block a user