[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 54/254: ftp: use private buffer for temp storage, n
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 54/254: ftp: use private buffer for temp storage, not receive buffer |
Date: |
Sat, 17 Jun 2017 16:51:26 +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 349789e645a306a6ee467ef90a57f6cc306ca92e
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon Apr 24 16:05:46 2017 +0200
ftp: use private buffer for temp storage, not receive buffer
---
lib/ftp.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/ftp.c b/lib/ftp.c
index a33a4e0ae..a0ea7cad1 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2101,17 +2101,17 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata
*conn,
/* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the
last .sss part is optional and means fractions of a second */
int year, month, day, hour, minute, second;
- char *buf = data->state.buffer;
- if(6 == sscanf(buf+4, "%04d%02d%02d%02d%02d%02d",
+ if(6 == sscanf(&data->state.buffer[4], "%04d%02d%02d%02d%02d%02d",
&year, &month, &day, &hour, &minute, &second)) {
/* we have a time, reformat it */
+ char timebuf[24];
time_t secs=time(NULL);
- /* using the good old yacc/bison yuck */
- snprintf(buf, CURL_BUFSIZE(conn->data->set.buffer_size),
+
+ snprintf(timebuf, sizeof(timebuf),
"%04d%02d%02d %02d:%02d:%02d GMT",
year, month, day, hour, minute, second);
/* now, convert this into a time() value: */
- data->info.filetime = (long)curl_getdate(buf, &secs);
+ data->info.filetime = (long)curl_getdate(timebuf, &secs);
}
#ifdef CURL_FTP_HTTPSTYLE_HEAD
@@ -2122,6 +2122,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata
*conn,
ftpc->file &&
data->set.get_filetime &&
(data->info.filetime>=0) ) {
+ char headerbuf[128];
time_t filetime = (time_t)data->info.filetime;
struct tm buffer;
const struct tm *tm = &buffer;
@@ -2131,7 +2132,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata
*conn,
return result;
/* format: "Tue, 15 Nov 1994 12:45:26" */
- snprintf(buf, BUFSIZE-1,
+ snprintf(headerbuf, sizeof(headerbuf),
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
tm->tm_mday,
@@ -2140,7 +2141,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata
*conn,
tm->tm_hour,
tm->tm_min,
tm->tm_sec);
- result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
+ result = Curl_client_write(conn, CLIENTWRITE_BOTH, headerbuf, 0);
if(result)
return result;
} /* end of a ridiculous amount of conditionals */
@@ -2318,9 +2319,10 @@ static CURLcode ftp_state_size_resp(struct connectdata
*conn,
if(instate == FTP_SIZE) {
#ifdef CURL_FTP_HTTPSTYLE_HEAD
if(-1 != filesize) {
- snprintf(buf, CURL_BUFSIZE(data->set.buffer_size),
+ char clbuf[128];
+ snprintf(clbuf, sizeof(clbuf),
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize);
- result = Curl_client_write(conn, CLIENTWRITE_BOTH, buf, 0);
+ result = Curl_client_write(conn, CLIENTWRITE_BOTH, clbuf, 0);
if(result)
return result;
}
@@ -2420,7 +2422,6 @@ static CURLcode ftp_state_get_resp(struct connectdata
*conn,
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
struct FTP *ftp = data->req.protop;
- char *buf = data->state.buffer;
if((ftpcode == 150) || (ftpcode == 125)) {
@@ -2464,6 +2465,7 @@ static CURLcode ftp_state_get_resp(struct connectdata
*conn,
*
* Example D above makes this parsing a little tricky */
char *bytes;
+ char *buf = data->state.buffer;
bytes=strstr(buf, " bytes");
if(bytes--) {
long in=(long)(bytes-buf);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 38/254: tests: added --remote-time tests for remaining protocols that support it, (continued)
- [GNUnet-SVN] [gnurl] 38/254: tests: added --remote-time tests for remaining protocols that support it, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 41/254: tests: fixed OOM handling of unit tests to abort test, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 55/254: CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 57/254: buffer_size: make sure it always has the correct size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 105/254: asyn-thread: fix unused macro warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 73/254: gtls: fixed a lingering BUFSIZE reference, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 70/254: BUFSIZE: rename to READBUFFER_*, make separate MASTERBUF_SIZE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 149/254: cmdline-opts/write-out.d: s/-L/--location, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 99/254: runtests.pl: simplify the datacheck read section, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 44/254: http2: declare TU-local variables static, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 54/254: ftp: use private buffer for temp storage, not receive buffer,
gnunet <=
- [GNUnet-SVN] [gnurl] 81/254: lib: fix compiler warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 47/254: tool_cb_prg: fix double-promotion warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 63/254: http-proxy: use a dedicated CONNECT response buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 94/254: curl_slist_append.3: clarify a NULL input creates a new list, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 112/254: libtest: fix MinGW-w64 warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 91/254: runtests: add -o to run test cases in scrambled order, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 115/254: tests: give each stunnel.conf file a unique name, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 113/254: tftpd: fix signed/unsigned mismatch warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 79/254: typecheck-gcc: add missing string options, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 83/254: CURLINFO_REDIRECT_URL.3: add example, gnunet, 2017/06/17