Add sanity check for a couple malloc() and make code more resilient

This commit is contained in:
Victor Hora
2018-11-04 22:04:34 -05:00
parent b3fa87dc7c
commit 9be0a407eb
4 changed files with 21 additions and 5 deletions

View File

@@ -312,6 +312,11 @@ int msc_remote_download_content(apr_pool_t *mp, const char *uri, const char *key
struct curl_slist *headers_chunk = NULL;
#ifdef WIN32
char *buf = malloc(sizeof(TCHAR) * (2048 + 1));
if (buf == NULL) { /* malloc failed... */
*error_msg = apr_psprintf(mp, "Unable to allocate memory");
ret = -2;
goto failed;
}
char *ptr = NULL;
DWORD res_len;
#endif