From: Daniel Stenberg Date: Wed, 21 May 2025 06:17:25 +0000 (+0200) Subject: ftplistparser: protect two more len -1 uses X-Git-Tag: curl-8_14_0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=196afaf75c4f04ebe33c60cc2ea07301a9b9321a;p=thirdparty%2Fcurl.git ftplistparser: protect two more len -1 uses Pointed out by Coverity Closes #17400 --- diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c index aaf91f311f..af2321af09 100644 --- a/lib/ftplistparser.c +++ b/lib/ftplistparser.c @@ -600,7 +600,7 @@ static CURLcode parse_unix(struct Curl_easy *data, switch(parser->state.UNIX.sub.time) { case PL_UNIX_TIME_PREPART1: if(c != ' ') { - if(ISALNUM(c)) { + if(ISALNUM(c) && len) { parser->item_offset = len -1; parser->item_length = 1; parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; @@ -884,7 +884,7 @@ static CURLcode parse_winnt(struct Curl_easy *data, case PL_WINNT_FILENAME: switch(parser->state.NT.sub.filename) { case PL_WINNT_FILENAME_PRESPACE: - if(c != ' ') { + if(c != ' ' && len) { parser->item_offset = len -1; parser->item_length = 1; parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT;