diff options
author | dartraiden <wowemuh@gmail.com> | 2018-06-01 22:53:12 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2018-06-01 23:14:03 +0300 |
commit | 2a7aa481eaf81a71e5c5682974fffe1aa1fc6202 (patch) | |
tree | 4df2f855b4235490e9b63f89927784fd4ea3220a /libs/libcurl/src/pop3.c | |
parent | df32d54d3b04bd5b4cfdc550b0d8b01fc12a7c15 (diff) |
libs/libcurl: update to 7.60
Diffstat (limited to 'libs/libcurl/src/pop3.c')
-rw-r--r-- | libs/libcurl/src/pop3.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/libs/libcurl/src/pop3.c b/libs/libcurl/src/pop3.c index 5792a4a6fd..78f6afef1f 100644 --- a/libs/libcurl/src/pop3.c +++ b/libs/libcurl/src/pop3.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -243,23 +243,30 @@ static bool pop3_endofresp(struct connectdata *conn, char *line, size_t len, */ static void pop3_get_message(char *buffer, char **outptr) { - size_t len = 0; + size_t len = strlen(buffer); char *message = NULL; - /* Find the start of the message */ - for(message = buffer + 2; *message == ' ' || *message == '\t'; message++) - ; - - /* Find the end of the message */ - for(len = strlen(message); len--;) - if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' && - message[len] != '\t') - break; - - /* Terminate the message */ - if(++len) { - message[len] = '\0'; + if(len > 2) { + /* Find the start of the message */ + len -= 2; + for(message = buffer + 2; *message == ' ' || *message == '\t'; + message++, len--) + ; + + /* Find the end of the message */ + for(; len--;) + if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' && + message[len] != '\t') + break; + + /* Terminate the message */ + if(++len) { + message[len] = '\0'; + } } + else + /* junk input => zero length output */ + message = &buffer[len]; *outptr = message; } |