Subject: Re: libssh2 master 63457df... Fix compiler warnings for size_t pointers on 32-bit Windows.

Re: libssh2 master 63457df... Fix compiler warnings for size_t pointers on 32-bit Windows.

From: Daiki Ueno <ueno_at_unixuser.org>
Date: Fri, 25 Dec 2009 13:05:43 +0900

Peter Stuge <peter_at_stuge.se> writes:

> libssh2_at_git.stuge.se wrote:
>> +++ b/src/userauth.c
>> @@ -628,6 +628,7 @@ sign_fromfile(LIBSSH2_SESSION *session, unsigned char **sig, size_t *sig_len,
...
>> + unsigned long _sig_len;
...
>> - if (privkeyobj->signv(session, sig, sig_len, 1, &datavec,
>> + if (privkeyobj->signv(session, sig, &_sig_len, 1, &datavec,
>> &hostkey_abstract)) {
>> if (privkeyobj->dtor) {
>> privkeyobj->dtor(session, abstract);
>> }
>> return -1;
>> }
>> + *sig_len = _sig_len;
>
> Could this have been solved with a cast?

Indeed, I was just worried about the case: sizeof(size_t) == 8 and
sizeof(unsigned long) == 4 (i.e. on Windows 64), *sig_len is not
properly initialized by the caller, then the upper(lower?) 4-bytes of
*sig_len will be unchanged.

But in the above case, the caller is userauth_publickey(), *sig_len
must be initialized properly :) Will fix soon.

Is there any recommendation on size_t/ssize_t/unsigned long usage?

Regards,

-- 
Daiki Ueno
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-12-25