lte: Add additional sanity checks for username/password

This commit is contained in:
Denis Kenzior 2018-10-22 11:46:08 -05:00
parent 924edf03ce
commit 2637bfd4ec
1 changed files with 6 additions and 0 deletions

View File

@ -285,12 +285,18 @@ static DBusMessage *lte_set_property(DBusConnection *conn,
lte->pending_info.auth_method = auth_method;
} else if (strcmp(property, LTE_USERNAME) == 0) {
if (strlen(str) > OFONO_GPRS_MAX_USERNAME_LENGTH)
return __ofono_error_invalid_format(msg);
if (g_str_equal(str, lte->info.username))
return dbus_message_new_method_return(msg);
g_strlcpy(lte->pending_info.username, str,
OFONO_GPRS_MAX_USERNAME_LENGTH + 1);
} else if (strcmp(property, LTE_PASSWORD) == 0) {
if (strlen(str) > OFONO_GPRS_MAX_PASSWORD_LENGTH)
return __ofono_error_invalid_format(msg);
if (g_str_equal(str, lte->info.password))
return dbus_message_new_method_return(msg);