Subject: [PATCH] In examples/x11.c, Make sure sizeof passed to read operation is correct

[PATCH] In examples/x11.c, Make sure sizeof passed to read operation is correct

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

sizeof(buf) expands to 8ULL (since its a pointer). This variable may
have been static in the past, leading to this error.

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 085b7be..6480dc8 100644
--- a/example/x11.c
+++ b/example/x11.c
@@ -217,7 +217,7 @@ static int x11_send_receive(LIBSSH2_CHANNEL *channel, int sock)
         memset((void *)buf,0,bufsize);
 
         /* Data in sock*/
-        rc = read(sock, buf,sizeof(buf));
+        rc = read(sock, buf, bufsize);
         if (rc > 0)
             rc = libssh2_channel_write(channel,buf, rc);
         else
-- 
1.7.7.6
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-03-12