Browse Source

smtp/pop3/imap_get_message: decrease the data length too...

Follow-up commit to 615edc1f73 which was incomplete.

Assisted-by: Max Dymond
Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5206
master
Daniel Stenberg 4 years ago
parent
commit
8dd4edeb90
No known key found for this signature in database GPG Key ID: 5CC908FDB71E12C2
3 changed files with 15 additions and 9 deletions
  1. +5
    -3
      lib/imap.c
  2. +5
    -3
      lib/pop3.c
  3. +5
    -3
      lib/smtp.c

+ 5
- 3
lib/imap.c View File

@ -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
@ -349,11 +349,13 @@ static void imap_get_message(char *buffer, char **outptr)
if(len > 2) {
/* Find the start of the message */
for(message = buffer + 2; *message == ' ' || *message == '\t'; message++)
len -= 2;
for(message = buffer + 2; *message == ' ' || *message == '\t';
message++, len--)
;
/* Find the end of the message */
for(len -= 2; len--;)
for(; len--;)
if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
message[len] != '\t')
break;


+ 5
- 3
lib/pop3.c View File

@ -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
@ -248,11 +248,13 @@ static void pop3_get_message(char *buffer, char **outptr)
if(len > 2) {
/* Find the start of the message */
for(message = buffer + 2; *message == ' ' || *message == '\t'; message++)
len -= 2;
for(message = buffer + 2; *message == ' ' || *message == '\t';
message++, len--)
;
/* Find the end of the message */
for(len -= 2; len--;)
for(; len--;)
if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
message[len] != '\t')
break;


+ 5
- 3
lib/smtp.c View File

@ -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
@ -237,11 +237,13 @@ static void smtp_get_message(char *buffer, char **outptr)
if(len > 4) {
/* Find the start of the message */
for(message = buffer + 4; *message == ' ' || *message == '\t'; message++)
len -= 4;
for(message = buffer + 4; *message == ' ' || *message == '\t';
message++, len--)
;
/* Find the end of the message */
for(len -= 4; len--;)
for(; len--;)
if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
message[len] != '\t')
break;


Loading…
Cancel
Save