r9122: cope with trailing garbage in POST contents in the web server
authorAndrew Tridgell <tridge@samba.org>
Fri, 5 Aug 2005 15:34:31 +0000 (15:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:31:18 +0000 (13:31 -0500)
(This used to be commit de0ac6a9d6f38f9c8067f974e3bdc1c9a164d638)

source4/web_server/web_server.c

index 50a01db3d4981d9444353f07ecfe2502970e93a7..80e479d8a7edcacd1da1c5cc3b531048a3705a9f 100644 (file)
@@ -103,7 +103,10 @@ static void websrv_recv(struct stream_connection *conn, uint16_t flags)
           a blank line) and any post data, as indicated by the
           content_length */
        if (web->input.end_of_headers &&
-           web->input.partial.length == web->input.content_length) {
+           web->input.partial.length >= web->input.content_length) {
+               if (web->input.partial.length > web->input.content_length) {
+                       web->input.partial.data[web->input.content_length] = 0;
+               }
                EVENT_FD_NOT_READABLE(web->conn->event.fde);
                http_process_input(web);
        }