Fixed http gateway body length read.
authorArmin Novak <armin.novak@thincast.com>
Thu, 18 Oct 2018 14:58:53 +0000 (16:58 +0200)
committerArmin Novak <armin.novak@thincast.com>
Fri, 19 Oct 2018 07:31:55 +0000 (09:31 +0200)
libfreerdp/core/gateway/http.c

index 6920d98..565c878 100644 (file)
@@ -842,15 +842,15 @@ HttpResponse* http_response_recv(rdpTls* tls)
                }
 
                if (response->BodyLength > 0)
-               {
                        response->BodyContent = &(Stream_Buffer(response->data))[payloadOffset];
-                       response->BodyLength = bodyLength;
-               }
 
                if (bodyLength != response->BodyLength)
                {
                        WLog_WARN(TAG, "http_response_recv: %s unexpected body length: actual: %d, expected: %d",
-                                 response->ContentType, bodyLength, response->BodyLength);
+                                 response->ContentType, response->BodyLength, bodyLength);
+
+                       if (bodyLength > 0)
+                               response->BodyLength = MIN(bodyLength, response->BodyLength);
                }
        }