Skip to content

Commit

Permalink
[connection-sharing] Avoid crash when no secondary dns is given in co…
Browse files Browse the repository at this point in the history
…nnman

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Jul 25, 2014
1 parent b0ca238 commit 1b48f52
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/usb_moded-network.c
Expand Up @@ -427,7 +427,7 @@ static int connman_fill_connection_data(DBusMessage *reply, struct ipforward_dat
{
DBusMessageIter array_iter, dict_iter, inside_dict_iter, variant_iter;
DBusMessageIter sub_array_iter, string_iter;
int type;
int type, next;
char *string;

log_debug("Filling in dns data\n");
Expand Down Expand Up @@ -464,7 +464,14 @@ static int connman_fill_connection_data(DBusMessage *reply, struct ipforward_dat
dbus_message_iter_get_basic(&string_iter, &string);
log_debug("dns = %s\n", string);
ipforward->dns1 = strdup(string);
dbus_message_iter_next (&string_iter);
next = dbus_message_iter_next (&string_iter);
if(!next)
{
log_debug("No secundary dns\n");
/* FIXME: set the same dns for dns2 to avoid breakage */
ipforward->dns2 = strdup(string);
return(0);
}
dbus_message_iter_get_basic(&string_iter, &string);
log_debug("dns2 = %s\n", string);
ipforward->dns2 = strdup(string);
Expand Down

0 comments on commit 1b48f52

Please sign in to comment.