[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 246/254: FindWin32CACert: Use a temporary buffer on
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 246/254: FindWin32CACert: Use a temporary buffer on the stack |
Date: |
Sat, 17 Jun 2017 16:54:38 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit e8fecf2614b479d2448c61159b4a7dadf4cf7df9
Author: Michael Kaufmann <address@hidden>
AuthorDate: Tue Jun 6 22:15:17 2017 +0200
FindWin32CACert: Use a temporary buffer on the stack
Don't malloc() the temporary buffer, and use the correct type:
SearchPath() works with TCHAR, but SearchPathA() works with char.
Set the buffer size to MAX_PATH, because the terminating null byte
is already included in MAX_PATH.
Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Closes #1548
---
src/tool_doswin.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index 48af3bfb8..91299986a 100644
--- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
@@ -646,24 +646,18 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
if(curlinfo->features & CURL_VERSION_SSL) {
DWORD res_len;
- DWORD buf_tchar_size = PATH_MAX + 1;
- DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size;
+ char buf[PATH_MAX];
char *ptr = NULL;
- char *buf = malloc(buf_bytes_size);
- if(!buf)
- return CURLE_OUT_OF_MEMORY;
buf[0] = '\0';
- res_len = SearchPathA(NULL, bundle_file, NULL, buf_tchar_size, buf, &ptr);
+ res_len = SearchPathA(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
if(res_len > 0) {
Curl_safefree(config->cacert);
config->cacert = strdup(buf);
if(!config->cacert)
result = CURLE_OUT_OF_MEMORY;
}
-
- Curl_safefree(buf);
}
return result;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 212/254: tool_util: remove unused tvdiff_secs and remove tool_ prefix, (continued)
- [GNUnet-SVN] [gnurl] 212/254: tool_util: remove unused tvdiff_secs and remove tool_ prefix, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 143/254: RELEASE-NOTES: synced with eb16305e6, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 93/254: unit1305: fix compiler warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 226/254: test1538: added "verbose logs" keyword, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 239/254: examples/multi-uv.c: fix deprecated symbol, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 159/254: cmake: remove unused variables: GNUTLS_ENABLED, NSS_ENABLED, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 173/254: TODO: 6.4 is done, send telnet data in chunks, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 221/254: BINDINGS: add Ring binding, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 216/254: x509asn1: fix implicit-fallthrough warning with GCC 7, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 179/254: mbedtls: fix variable shadow warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 246/254: FindWin32CACert: Use a temporary buffer on the stack,
gnunet <=
- [GNUnet-SVN] [gnurl] 232/254: README.md: show the coverall coverage on github, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 106/254: tool_parsecfg: fix -Wcast-qual warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 64/254: unit1606: do not print/access buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 135/254: tests: added missing keywords "chunked Transfer-Encoding", gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 242/254: lib1521: fix compiler warnings on the use of bad 'long' values, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 60/254: pingpong: use the set buffer size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 236/254: configure: fix link with librtmp when specifying path, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 127/254: formdata: fix -Wcomma warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 147/254: oauth2-bearer.d: mention the <token> argument, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 122/254: tests: removed redundant --trace-ascii arguments, gnunet, 2017/06/17