From 60f39a3ae315cef94b47a18a9a51ba549051389c Mon Sep 17 00:00:00 2001 From: defanor Date: Sat, 29 Feb 2020 18:00:48 +0300 Subject: Check that the initial JID is non-NULL --- src/rexmpp.c | 5 +++++ src/rexmpp.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/rexmpp.c b/src/rexmpp.c index 04ec798..c9ec44e 100644 --- a/src/rexmpp.c +++ b/src/rexmpp.c @@ -101,6 +101,11 @@ rexmpp_err_t rexmpp_init (rexmpp_t *s, s->xml_in_cb = xml_in_cb; s->xml_out_cb = xml_out_cb; + if (jid == NULL) { + rexmpp_log(s, LOG_CRIT, "No initial JID is provided."); + return REXMPP_E_JID; + } + s->xml_parser = xmlCreatePushParserCtxt(&sax, s, "", 0, NULL); if (s->xml_parser == NULL) { diff --git a/src/rexmpp.h b/src/rexmpp.h index 662d540..8c006e9 100644 --- a/src/rexmpp.h +++ b/src/rexmpp.h @@ -129,6 +129,8 @@ enum rexmpp_err { REXMPP_E_DNS, /** XML-related error. */ REXMPP_E_XML, + /** JID-related error. */ + REXMPP_E_JID, /** Failure to allocate memory. */ REXMPP_E_MALLOC }; -- cgit v1.2.3