]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ssh-libssh.c: fix left shift compiler warning
authorDaniel Stenberg <daniel@haxx.se>
Thu, 3 May 2018 20:16:57 +0000 (22:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 May 2018 20:16:57 +0000 (22:16 +0200)
ssh-libssh.c:2429:21: warning: result of '1 << 31' requires 33 bits to
represent, but 'int' only has 32 bits [-Wshift-overflow=]

'len' will never be that big anyway so I converted the run-time check to
a regular assert.

lib/ssh-libssh.c

index 9e6667295d75a4997437a602591ffd2f801b8d98..34ef490c4e09c83c07b8bc39821cd2f4d1eb4637 100644 (file)
@@ -2425,8 +2425,7 @@ static ssize_t sftp_recv(struct connectdata *conn, int sockindex,
   ssize_t nread;
   (void)sockindex;
 
-  if(len >= (size_t)1<<32)
-    len = (size_t)(1<<31)-1;
+  DEBUGASSERT(len < CURL_MAX_READ_SIZE);
 
   switch(conn->proto.sshc.sftp_recv_state) {
     case 0: