mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-06 20:25:51 +03:00
coap_gnutls.c: Fixed NULL pointer dereference
Avoid calling gnutls_transport_get_ptr() on a NULL pointer. The crash can be reproduced by sending an invalid CA certificate.
This commit is contained in:
1 parent
7b98419dae
commit
afb0d954ed
1 file changed
+8
-3
+8
-3
@@ -161,9 +161,14 @@ coap_get_tls_library_version(void) {
|
||||
static void
|
||||
coap_gnutls_audit_log_func(gnutls_session_t g_session, const char* text)
|
||||
{
|
||||
coap_session_t *c_session =
|
||||
(coap_session_t *)gnutls_transport_get_ptr(g_session);
|
||||
coap_log(LOG_WARNING, "** %s: %s", coap_session_str(c_session), text);
|
||||
if (g_session) {
|
||||
coap_session_t *c_session =
|
||||
(coap_session_t *)gnutls_transport_get_ptr(g_session);
|
||||
coap_log(LOG_WARNING, "** %s: %s",
|
||||
coap_session_str(c_session), text);
|
||||
} else {
|
||||
coap_log(LOG_WARNING, "** (null): %s", text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in new issue
Block a user