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

buffer overflow in server #6

Open
paulpach opened this issue Jun 15, 2017 · 0 comments
Open

buffer overflow in server #6

paulpach opened this issue Jun 15, 2017 · 0 comments

Comments

@paulpach
Copy link

When doing client/server programming, never trust the client. A malicious user may create his client and send junk to your server to exploit vulnerabilities.

the following code:

    int HttpParser::_parse_headers(char* recv_buf, Request& request) {
        char *p = recv_buf;
        char key[1024];
        char value[10 * 1024];
        int i = 0;
        int parse_len = 0;
        while (1) {
            if (*p == '\r' && *(p + 1) == '\n') {
                break;
            }

assumes that the header is terminated by a "\r\n", if the client does not do that, your method would keep on reading past the buffer and make your server crash.

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

1 participant