www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Re: [libssh2] All Your Mem Belongs to Us

Re: [libssh2] All Your Mem Belongs to Us

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 10 Nov 2006 14:41:58 +0100 (CET)

On Fri, 10 Nov 2006, Satish Mittal wrote:

> if (ret == 0) continue;
> Where ret is the return status of recv() being called above. Now if recv()
> returns 0, this means that no messages are available to be received and the
> peer has performed an orderly shutdown. Whereas here we just continue in the
> while loop!
> Won't this lead to an infinite hang as the remote server has already closed
> the connection? Perhaps we may want to treat (ret=0) also as a failure case
> and return -1 from blocking_read.

Yes indeed, getting a 0 back from recv() with the socket set to blocking
really can't be good in this sense, so I would expect it to at least deal with
it somehow and not just loop.

... and searching through src/packet.c we can spot the same "solution" in
multiple places - but then mostly when treating the return code from
libssh2_packet_read(). I don't see how they are correct either, but perhaps
I'm not getting the whole picture yet.

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
libssh2-devel mailing list
Received on 2006-11-10

the libssh2 team