Skip to contentSkip to conversation

libssh: fix some -Werror=strict-overflow build failures

PATCH New Baruch Siach 2 participants 2 messages Jan 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libssh: fix some -Werror=strict-overflow build failures

Add fixes for some of the build failures caused by strict-overflow warnings. Patches #1, #2, and #4 are upstream. Patch #3 is pending upstream.

Fixes:
http://autobuild.buildroot.net/results/923/9239f230629ca4e381af5e8f43989997d9bfde99/
http://autobuild.buildroot.net/results/618/6187b92bcdfd9281683c37906ae74f2e0c5e6d0e/
http://autobuild.buildroot.net/results/9eb/9eb5ed92a923f0c038e3d913289eddc1cda1b62f/

---
 ...uffer-Fix-size-comparison-with-count.patch |  48 ++++++
 ...t-for-argc-argument-in-ssh_buffer_-u.patch | 152 ++++++++++++++++++
 .../0003-more-strict-overflow-fixes.patch     | 122 ++++++++++++++
 ...x-size-type-for-i-an-j-in-ssh_select.patch |  29 ++++
 4 files changed, 351 insertions(+)
 create mode 100644 package/libssh/0001-buffer-Fix-size-comparison-with-count.patch
 create mode 100644 package/libssh/0002-buffer-Use-size_t-for-argc-argument-in-ssh_buffer_-u.patch
 create mode 100644 package/libssh/0003-more-strict-overflow-fixes.patch
 create mode 100644 package/libssh/0004-connect-Fix-size-type-for-i-an-j-in-ssh_select.patch
package/libssh/0001-buffer-Fix-size-comparison-with-count.patch new file +48 -0
new file mode 100644
index 000000000000..88e1bc3b48c1
@@ -0,0 +1,48 @@
+From 2aa8c46a853acd4198af16e417ebffd5b0e2c9f4 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <[email protected]>
+Date: Mon, 1 Oct 2018 20:58:47 +0200
+Subject: [PATCH] buffer: Fix size comparison with count
+
+Signed-off-by: Andreas Schneider <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Upstream status: commit 9c3ba94960cd5
+
+ src/buffer.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/buffer.c b/src/buffer.c
+index da6e587fc9e4..b029f202660f 100644
+--- a/src/buffer.c
++++ b/src/buffer.c
+@@ -816,8 +816,8 @@ static int ssh_buffer_pack_allocate_va(struct ssh_buffer_struct *buffer,
+     ssh_string string = NULL;
+     char *cstring = NULL;
+     size_t needed_size = 0;
+-    size_t count;
+     size_t len;
++    int count; /* int for size comparison with argc */
+     int rc = SSH_OK;
+ 
+     for (p = format, count = 0; *p != '\0'; p++, count++) {
+@@ -934,7 +934,7 @@ int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer,
+     char *cstring;
+     bignum b;
+     size_t len;
+-    int count;
++    int count; /* int for size comparison with argc */
+ 
+     for (p = format, count = 0; *p != '\0'; p++, count++) {
+         /* Invalid number of arguments passed */
+@@ -1098,7 +1098,7 @@ int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
+     } o;
+     size_t len, rlen, max_len;
+     va_list ap_copy;
+-    int count;
++    int count; /* int for size comparison with argc */
+ 
+     max_len = ssh_buffer_get_len(buffer);
+ 
+-- 
+2.20.1
+
package/libssh/0002-buffer-Use-size_t-for-argc-argument-in-ssh_buffer_-u.patch new file +152 -0

152 lines not on this page · raw message

package/libssh/0003-more-strict-overflow-fixes.patch new file +122 -0

122 lines not on this page · raw message

package/libssh/0004-connect-Fix-size-type-for-i-an-j-in-ssh_select.patch new file +29 -0
new file mode 100644
index 000000000000..9e2bf9eea032
@@ -0,0 +1,29 @@
+From c95bf48d0ef26ccf2135e09f0b2f8d0e54bd88e9 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <[email protected]>
+Date: Fri, 7 Dec 2018 12:07:13 +0100
+Subject: [PATCH] connect: Fix size type for i an j in ssh_select()
+
+Signed-off-by: Andreas Schneider <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Upstream status: commit 58113d489eecf
+
+ src/connect.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/connect.c b/src/connect.c
+index 6c09c3f638ba..7ff7513fb3e8 100644
+--- a/src/connect.c
++++ b/src/connect.c
+@@ -476,7 +476,7 @@ int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
+     fd_set *readfds, struct timeval *timeout) {
+   fd_set origfds;
+   socket_t fd;
+-  int i,j;
++  size_t i, j;
+   int rc;
+   int base_tm, tm;
+   struct ssh_timestamp ts;
+-- 
+2.20.1
+
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 libssh: fix some -Werror=strict-overflow build failures

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

Add fixes for some of the build failures caused by strict-overflow warnings. Patches #1, #2, and #4 are upstream. Patch #3 is pending upstream.

Quoted 7 lines

Fixes:
http://autobuild.buildroot.net/results/923/9239f230629ca4e381af5e8f43989997d9bfde99/
http://autobuild.buildroot.net/results/618/6187b92bcdfd9281683c37906ae74f2e0c5e6d0e/
http://autobuild.buildroot.net/results/9eb/9eb5ed92a923f0c038e3d913289eddc1cda1b62f/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard