diff options
author | Dane Springmeyer <dane@mapbox.com> | 2014-05-30 13:26:59 -0700 |
---|---|---|
committer | Dane Springmeyer <dane@mapbox.com> | 2014-05-30 13:26:59 -0700 |
commit | 7adbc8371f9dbac7ac19b12f7690d6707d688427 (patch) | |
tree | 24880f821610c745abd2fbcbfc8a2298ceff1ff8 /common | |
parent | d19870d9d280b1614f6bb747629652ec66cb492a (diff) | |
download | qtlocation-mapboxgl-7adbc8371f9dbac7ac19b12f7690d6707d688427.tar.gz |
[hardening] avoid accessing potentially uninitialized memory
Diffstat (limited to 'common')
-rw-r--r-- | common/curl_request.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/curl_request.cpp b/common/curl_request.cpp index 7eae7fd95e..40d94b9569 100644 --- a/common/curl_request.cpp +++ b/common/curl_request.cpp @@ -190,7 +190,7 @@ void curl_perform(uv_poll_t *req, int /*status*/, int events) { } int handle_socket(CURL * /*easy*/, curl_socket_t s, int action, void * /*userp*/, void *socketp) { - curl_context *context; + curl_context *context = nullptr; if (action == CURL_POLL_IN || action == CURL_POLL_OUT) { if (socketp) { context = (curl_context *)socketp; @@ -199,6 +199,9 @@ int handle_socket(CURL * /*easy*/, curl_socket_t s, int action, void * /*userp*/ } curl_multi_assign(curl_multi, s, (void *)context); } + if (!context) { + throw std::runtime_error("unhandled action in socket handling"); + } switch (action) { case CURL_POLL_IN: |