Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielgustafsson/64350f30a1557d18415d1ca875851c73 to your computer and use it in GitHub Desktop.
Save danielgustafsson/64350f30a1557d18415d1ca875851c73 to your computer and use it in GitHub Desktop.
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c
index 949c7fa17..e3f4d5805 100644
--- a/lib/curl_ntlm_wb.c
+++ b/lib/curl_ntlm_wb.c
@@ -324,6 +324,8 @@ static CURLcode ntlm_wb_response(struct connectdata *conn,
conn->response_header = aprintf("NTLM %.*s", len_out - 4, buf + 3);
free(buf);
+ if (!conn->response_header)
+ return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
done:
free(buf);
@@ -397,6 +399,10 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
conn->response_header);
+ if(!*allocuserpwd) {
+ free(conn->response_header);
+ return CURLE_OUT_OF_MEMORY;
+ }
DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd));
free(conn->response_header);
conn->response_header = NULL;
@@ -415,6 +421,10 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
conn->response_header);
+ if(!*allocuserpwd) {
+ free(conn->response_header);
+ return CURLE_OUT_OF_MEMORY;
+ }
DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd));
ntlm->state = NTLMSTATE_TYPE3; /* we sent a type-3 */
authp->done = TRUE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment