Subject: Re: [libssh2] libssh2_sftp_read* bug

Re: [libssh2] libssh2_sftp_read* bug

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 14 Feb 2007 13:41:52 +0100 (CET)

On Tue, 13 Feb 2007, Lucas Newman wrote:

> Here's a patch that addresses it.

Thanks a lot. How about this minor rewrite of it, to make the logic somewhat
easier to follow (at least in my brain):

--- src/transport.c 2 Feb 2007 23:23:37 -0000 1.2
+++ src/transport.c 14 Feb 2007 12:44:57 -0000
@@ -427,7 +427,17 @@
                                          p->data_num;
                          }
                          else {
+ int frac;
                                  numdecrypt = numbytes;
+ frac = numdecrypt % blocksize;
+ if(frac) {
+ /* not an aligned amount of blocks,
+ align it */
+ numdecrypt -= frac;
+ /* and make it no unencrypted data
+ after it */
+ numbytes = 0;
+ }
                          }
                  }
                  else {

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-02-14