Subject: [PATCH] Fix suspicious sizeof usage in examples/x11.c

[PATCH] Fix suspicious sizeof usage in examples/x11.c

From: Steven Dake <sdake_at_redhat.com>
Date: Sun, 11 Mar 2012 23:09:09 -0700

In the x11 example, sizeof(buf) = 8UL (on x86_64), when this should
probably represent the buffer size available. I am not sure how to
test that this change is actually correct, however.

Signed-off-by: Steven Dake <sdake_at_redhat.com>

---
 example/x11.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/example/x11.c b/example/x11.c
index 86dca0f..085b7be 100644
--- a/example/x11.c
+++ b/example/x11.c
@@ -208,7 +208,7 @@ static int x11_send_receive(LIBSSH2_CHANNEL *channel, int sock)
 
     rc = libssh2_poll(fds, nfds, 0);
     if (rc >0) {
-        rc = libssh2_channel_read(channel, buf,sizeof(buf));
+        rc = libssh2_channel_read(channel, buf, bufsize);
         rc = write(sock, buf, rc);
     }
 
-- 
1.7.7.6
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-03-12