Francois Gouget : testbot/testagentd: Sanity check the list sizes.
Alexandre Julliard
julliard at winehq.org
Wed Mar 27 13:09:01 CDT 2013
Module: tools
Branch: master
Commit: b48ed0abc3eeafe5639223576b3ab246af226c20
URL: http://source.winehq.org/git/tools.git/?a=commit;h=b48ed0abc3eeafe5639223576b3ab246af226c20
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Mar 27 16:37:51 2013 +0100
testbot/testagentd: Sanity check the list sizes.
This heuristic normally lets us detect and drop connections that use the wrong protocol.
---
testbot/src/testagentd/testagentd.c | 15 +++++++++++----
1 files 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)
More information about the wine-cvs
mailing list