testbot/testagentd: Sanity check the list sizes.
Francois Gouget
fgouget at codeweavers.com
Wed Mar 27 10:37:51 CDT 2013
This heuristic normally lets us detect and drop connections that use the wrong protocol.
---
Like doing a telnet and typing 'GET /...'.
testbot/src/testagentd/testagentd.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/testbot/src/testagentd/testagentd.c b/testbot/src/testagentd/testagentd.c
index 75782c4..e99dcb4 100644
--- a/testbot/src/testagentd/testagentd.c
+++ b/testbot/src/testagentd/testagentd.c
@@ -387,10 +387,17 @@ static int skip_entries(SOCKET client, uint32_t count)
static int recv_list_size(SOCKET client, uint32_t *u32)
{
- int success = recv_raw_uint32(client, u32);
- if (success)
- debug(" recv_list_size() -> %u\n", *u32);
- return success;
+ if (!recv_raw_uint32(client, u32))
+ return 0;
+ debug(" recv_list_size() -> %u\n", *u32);
+
+ if (*u32 >= 1048576)
+ {
+ /* The client is in fact most likely not speaking the right protocol */
+ set_status(ST_FATAL, "the list size is too big (%d)", *u32);
+ return 0;
+ }
+ return 1;
}
static int expect_list_size(SOCKET client, uint32_t expected)
--
1.7.10.4
More information about the wine-patches
mailing list