Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GoldSource] Client-side mapcycle processing can fail #2318

Closed
2010kohtep opened this issue Apr 27, 2019 · 3 comments
Closed

[GoldSource] Client-side mapcycle processing can fail #2318

2010kohtep opened this issue Apr 27, 2019 · 3 comments
Assignees

Comments

@2010kohtep
Copy link

When a client connects to the server, the server sends mapcycle to the client, which is written in the SV_SendServerinfo function. The problem is that the server can send a very large mapcycle list, length of which can be more or equal to 8192, what is the maximum size of returned buffer in MSG_ReadString, which is called in CL_ParseServerInfo. Unread bytes will cause the client to crash.

image

image

One of the solutions that I see in the client-side: since one of the images shows that mapcycle is not used by the client, we can simply skip this data. Let's say we can write function like this and replace MSG_ReadString call with it:

image

As a result, a mapcycle of any length will be successfully processed.

There is also a solution for server-side: after receiving the mapcycle with the COM_LoadFileForMe function, we cut it in position 8190 by setting zero byte so that the client can handle the mapcycle if its size is too large.

I believe that it is desirable to implement both of the proposed solutions.

@mikela-valve mikela-valve self-assigned this Apr 27, 2019
@mikela-valve mikela-valve added this to the Next Release milestone Apr 27, 2019
@mikela-valve
Copy link
Member

Fixed in client and server, will be included in next beta.

@mikela-valve
Copy link
Member

mikela-valve commented May 21, 2019

Fixed in beta 'Exe build: 11:12:36 May 21 2019 (8244)'.

@mikela-valve
Copy link
Member

Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants