Check for name element when reading mechanisms
Fixes an issue where the server sends whitespace between elements, a segfault would occur when performing a strcmp on the name.
This commit is contained in:
@@ -239,7 +239,7 @@ static int _handle_features(xmpp_conn_t * const conn,
|
|||||||
if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_SASL) == 0)) {
|
if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_SASL) == 0)) {
|
||||||
for (mech = xmpp_stanza_get_children(child); mech;
|
for (mech = xmpp_stanza_get_children(child); mech;
|
||||||
mech = xmpp_stanza_get_next(mech)) {
|
mech = xmpp_stanza_get_next(mech)) {
|
||||||
if (strcmp(xmpp_stanza_get_name(mech), "mechanism") == 0) {
|
if (xmpp_stanza_get_name(mech) && strcmp(xmpp_stanza_get_name(mech), "mechanism") == 0) {
|
||||||
text = xmpp_stanza_get_text(mech);
|
text = xmpp_stanza_get_text(mech);
|
||||||
if (strcasecmp(text, "PLAIN") == 0)
|
if (strcasecmp(text, "PLAIN") == 0)
|
||||||
conn->sasl_support |= SASL_MASK_PLAIN;
|
conn->sasl_support |= SASL_MASK_PLAIN;
|
||||||
|
|||||||
Reference in New Issue
Block a user