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

Received bad header from gateway when you have tons of remote subnets #575

Closed
m33m33 opened this issue Mar 19, 2020 · 1 comment
Closed

Comments

@m33m33
Copy link
Contributor

m33m33 commented Mar 19, 2020

Hi

It seems you get the "Received bad header from gateway" error when your vpn server has tons of routes to remote subnets to push to the client.

I have narrowed the issue down to a hardcoded buffer size.

Here is the log, and a generous size increase of the buffer size... is it safe ?

It looks good - works well here at least.

openfortivpn.log

@DimitriPapadopoulos
Copy link
Collaborator

Strange, I would have expected at least a warning such as Response too big:

openfortivpn/src/http.c

Lines 209 to 210 in f7110c4

if (bytes_read == BUFSZ - 1) {
log_warn("Response too big\n");

Anyway, thank you for reporting this!

In the short term I don't know if there's some magic buffer size that would be guaranteed to fit all. In any case a BUFSZ value of 0x10000 would use 64 KB, which shouldn't be a problem nowadays on any decent computer.
In the long term, we might need to change for a solution based on realloc() or use an existing external library as already suggested for XML or HTTP parsing.

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