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

Uninitialised fields when OpenSSL is enabled #17

Closed
zhiayang opened this issue May 19, 2020 · 0 comments
Closed

Uninitialised fields when OpenSSL is enabled #17

zhiayang opened this issue May 19, 2020 · 0 comments

Comments

@zhiayang
Copy link

zhiayang commented May 19, 2020

The socket destructor unconditionally calls this->close(), and that checks:

if(pSSL && pContext) {
    SSL_xxx(...)
}

Unfortunately these fields are pointers that aren't initialised to a value unless you connect() the socket first. So, destructing an unconnected socket with SSL enabled will most likely result in trying to pass garbage pointers to openSSL and causing a crash.

A simple fix is just to set them to nullptr either at the declaration site or in the constructor. They also need to be set to zero when moved from, similar to this getaddrinfo_results fix.

Ybalrid added a commit that referenced this issue May 21, 2020
@Ybalrid Ybalrid mentioned this issue May 22, 2020
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