From: Daniel Stenberg Date: Tue, 3 Oct 2017 15:20:06 +0000 (+0200) Subject: ftp: UBsan fixup 'pointer index expression overflowed' X-Git-Tag: curl-7_56_1~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a69a4d222d661268e196d481a2a2b5c3c4cd6848;p=curl ftp: UBsan fixup 'pointer index expression overflowed' Closes #1939 --- diff --git a/lib/ftp.c b/lib/ftp.c index 54ba4057f..d7be88136 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2419,8 +2419,8 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn, char *bytes; char *buf = data->state.buffer; bytes = strstr(buf, " bytes"); - if(bytes--) { - long in = (long)(bytes-buf); + if(bytes) { + long in = (long)(--bytes-buf); /* this is a hint there is size information in there! ;-) */ while(--in) { /* scan for the left parenthesis and break there */