summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-02-29 18:00:48 +0300
committerdefanor <defanor@uberspace.net>2020-02-29 18:00:48 +0300
commit60f39a3ae315cef94b47a18a9a51ba549051389c (patch)
treecb07b9b34165929ab44214b2534f4086d3351df4
parent239248f77bb21139b158950a548ff84ada4b3bf1 (diff)
Check that the initial JID is non-NULL
-rw-r--r--src/rexmpp.c5
-rw-r--r--src/rexmpp.h2
2 files changed, 7 insertions, 0 deletions
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
};