]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] fix possible crash in debug mode with invalid responses
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Apr 2010 07:14:45 +0000 (09:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 29 Apr 2010 05:09:25 +0000 (07:09 +0200)
When trying to display an invalid request or response we received,
we must at least check that we have identified something looking
like a start of message, otherwise we can dereference a NULL pointer.

src/proto_http.c

index 0f6f77bb7b946a0e3278379bebd9c796f1abb530..882f0dc4dca7a075ef264ea6c3e6c796c2998725 100644 (file)
@@ -2408,6 +2408,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
        /* 1: we might have to print this header in debug mode */
        if (unlikely((global.mode & MODE_DEBUG) &&
                     (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
+                    msg->sol &&
                     (msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
                char *eol, *sol;
 
@@ -4312,6 +4313,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
        /* 1: we might have to print this header in debug mode */
        if (unlikely((global.mode & MODE_DEBUG) &&
                     (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)) &&
+                    msg->sol &&
                     (msg->msg_state >= HTTP_MSG_BODY || msg->msg_state == HTTP_MSG_ERROR))) {
                char *eol, *sol;