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

HPCC-31655 ALA ensure appropriate mem allocation #18586

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ static void submitKQLQuery(std::string & readBuffer, const char * token, const c
char curlErrBuffer[CURL_ERROR_SIZE];
curlErrBuffer[0] = '\0';

char * encodedKQL = curl_easy_escape(curlHandle, kql, strlen(kql));
char * encodedTimeSpan = curl_easy_escape(curlHandle, timeSpan, strlen(timeSpan));
char * encodedKQL = curl_easy_escape(curlHandle, kql, strlen(kql)+1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation I don't think this change is correct. It should be the length of the string - this will add a %00 onto the end which you don't want.
I think coverity is actually complaining about a bug in the curl code - where the maximum length is not including a byte for the null terminator. I think
curl_easy_escape(, "\0", 1) may return CURLE_TOO_LARGE ( Ihaven't tested).

char * encodedTimeSpan = curl_easy_escape(curlHandle, timeSpan, strlen(timeSpan)+1);
VStringBuffer kqlQueryString("https://api.loganalytics.azure.com/v1/workspaces/%s/query?query=%s&timespan=%s", workspaceID, encodedKQL, encodedTimeSpan);
curl_free(encodedTimeSpan);
curl_free(encodedKQL);
Expand Down
Loading