]> granicus.if.org Git - curl/commitdiff
ftp: UBsan fixup 'pointer index expression overflowed'
authorDaniel Stenberg <daniel@haxx.se>
Tue, 3 Oct 2017 15:20:06 +0000 (17:20 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 4 Oct 2017 12:47:09 +0000 (14:47 +0200)
Closes #1939

lib/ftp.c

index 54ba4057fe9a31f0f822c870e7e7306d031414ca..d7be88136fb48860c51c8fe2b12fcfc43c21a023 100644 (file)
--- 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 */