]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_event_socket: Fix a segfault on authlogin with missing domain
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Wed, 28 Dec 2011 05:35:05 +0000 (00:35 -0500)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Wed, 28 Dec 2011 05:35:05 +0000 (00:35 -0500)
src/mod/event_handlers/mod_event_socket/mod_event_socket.c

index d35488d2358af0d47b691396bb7ee58c35c088f0..e873114ed4fe023881b987ea9d694e0a40a41bfd 100644 (file)
@@ -1605,7 +1605,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                        const char *allowed_api;
                        const char *allowed_events;
                        switch_event_t *params;
-                       char *user, *domain_name, *pass;
+                       char *user = NULL, *domain_name = NULL, *pass = NULL;
                        switch_xml_t x_domain = NULL, x_domain_root, x_user = NULL, x_params, x_param, x_group = NULL;
                        int authed = 0;
                        char *edup = NULL;
@@ -1621,11 +1621,11 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
 
                        user = cmd + 9;
 
-                       if ((domain_name = strchr(user, '@'))) {
+                       if (user && (domain_name = strchr(user, '@'))) {
                                *domain_name++ = '\0';
                        }
 
-                       if ((pass = strchr(domain_name, ':'))) {
+                       if (domain_name && (pass = strchr(domain_name, ':'))) {
                                *pass++ = '\0';
                        }