libcli/echo: validate the message length
authorStefan Metzmacher <metze@samba.org>
Fri, 21 Sep 2012 20:18:10 +0000 (22:18 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 22 Sep 2012 02:31:06 +0000 (04:31 +0200)
metze

libcli/echo/echo.c

index b6005cb32c07f94f1024d01374a6f6ae0393e177..0f5f7f77b169de5f60e3c82854b85c13663bcdd7 100644 (file)
@@ -172,6 +172,11 @@ static void echo_request_done(struct tevent_req *subreq)
                return;
        }
 
+       if (len != state->orig_len) {
+               tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE);
+               return;
+       }
+
        state->message[len-1] = '\0';
        /* Once the async function has completed, set tevent_req_done() */
        tevent_req_done(req);