diff --git a/dlls/webservices/tests/channel.c b/dlls/webservices/tests/channel.c index 4cf39c10732..c64027fb86d 100644 --- a/dlls/webservices/tests/channel.c +++ b/dlls/webservices/tests/channel.c @@ -1217,12 +1217,13 @@ static const char send_record_end[] = { 0x08, 0x02, 0x6e, 0x73, 0x89, 0xff, 0x01 static BOOL send_dict_str( int sock, char *addr, const char *str, int dict_str_count ) { char buf[512], dict_buf[256], body_buf[128], dict_size_buf[5]; + const int max_len = ARRAY_SIZE(dict_buf) - ARRAY_SIZE(dict_size_buf); int offset, dict_buf_size, body_buf_size, dict_size; /* Session dictionary strings. */ - offset = write_size( dict_buf, strlen(str) ); - memcpy( dict_buf + offset, str, strlen(str) ); - dict_buf_size = strlen(str) + offset; + offset = write_size( dict_buf, strnlen(str, max_len) ); + memcpy( dict_buf + offset, str, strnlen(str, max_len) ); + dict_buf_size = strnlen( str, max_len ) + offset; dict_size = write_size( dict_size_buf, dict_buf_size );