mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-21 14:00:51 +03:00
Add NULL session check to _libssh2_error_flags() (#796)
Don't dereference null if a null session happens to make it into _libssh2_error_flags()
This commit is contained in:
@@ -65,6 +65,12 @@
|
||||
int _libssh2_error_flags(LIBSSH2_SESSION* session, int errcode,
|
||||
const char *errmsg, int errflags)
|
||||
{
|
||||
if(session == NULL) {
|
||||
if(errmsg != NULL)
|
||||
fprintf(stderr, "Session is NULL, error: %s\n", errmsg);
|
||||
return errcode;
|
||||
}
|
||||
|
||||
if(session->err_flags & LIBSSH2_ERR_FLAG_DUP)
|
||||
LIBSSH2_FREE(session, (char *)session->err_msg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user