libs...@git.stuge.se wrote:
> +++ b/src/channel.c
> @@ -1483,10 +1483,11 @@ libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL 
> *channel,
>                                  char **langtag,
>                                  size_t *langtag_len)
>  {
> -    LIBSSH2_SESSION *session = channel->session;
>      size_t namelen = 0;
>  
>      if (channel) {
> +        LIBSSH2_SESSION *session = channel->session;
> +
>          if (channel->exit_signal) {
>              namelen = strlen(channel->exit_signal);
>              if (exitsignal) {

I think this fix is wrong. Please look at what happens after the condition.

Also, I don't think that libssh2 needs to validate programmer input.
If someone passes a NULL pointer to a function that is really an
error, and they will then have a problem sooner or later anyway.

It is much better for libssh2 to crash fast and hard in this case, to
have a higher chance that the programmer discovers the error.

Papering over the error just to please a static analyzer does not
make sense.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to