cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bug in ssh.c?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 2 Sep 2009 23:06:01 +0200 (CEST)

On Wed, 2 Sep 2009, Daniel Johnson wrote:

> ../../curl/lib/ssh.c:239:10: warning: overflow converting case value to
> switch condition type (-6 to 4294967290)
> case LIBSSH2_ERROR_ALLOC:
> ^
> /Volumes/MacintoshHD/deps/include/libssh2.h:326:49: note: instantiated from:
> #define LIBSSH2_ERROR_ALLOC -6
> ^
> 1 diagnostic generated.
>
> Sure enough, err is declared to be unsigned long. Perhaps
> sftp_libssh2_error_to_CURLE should take a signed long instead?

Whoa, nice catch. Since the 'err' passed in is a plain 'int' in every place I
think the function should accept that.

But as a secondary error: LIBSSH2_ERROR_ALLOC is not a legitimate sftp error
so it shouldn't be in that switch() statement in the first place!

Fix committed, thanks!

-- 
  / daniel.haxx.se
Received on 2009-09-02