Hi Christophe,
On 05/09/2017 09:52 AM, Christophe Ronco wrote:
pri_set_apn is called by ofono_gprs_cid_activated() when attached
using LTE technology.
This patch avoid calling DBUS functions in this case. Without
this patch we have a crash in ofono process in this case.
diff --git a/src/gprs.c b/src/gprs.c
index c5e7709..9c6d282 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1027,14 +1027,28 @@ static DBusMessage *pri_set_apn(struct pri_context *ctx,
DBusConnection *conn,
{
GKeyFile *settings = ctx->gprs->settings;
- if (strlen(apn) > OFONO_GPRS_MAX_APN_LENGTH)
- return __ofono_error_invalid_format(msg);
+ if (strlen(apn) > OFONO_GPRS_MAX_APN_LENGTH) {
+ if (msg)
+ return __ofono_error_invalid_format(msg);
- if (g_str_equal(apn, ctx->context.apn))
- return dbus_message_new_method_return(msg);
+ DBG("APN %s too long", apn);
+ return NULL;
+ }
- if (is_valid_apn(apn) == FALSE)
- return __ofono_error_invalid_format(msg);
+ if (g_str_equal(apn, ctx->context.apn)) {
+ if (msg)
+ return dbus_message_new_method_return(msg);
+
+ return NULL;
Returning NULL on a success path doesn't really make any sense.
+ }
+
+ if (is_valid_apn(apn) == FALSE) {
+ if (msg)
+ return __ofono_error_invalid_format(msg);
+
+ DBG("APN %s invalid", apn);
+ return NULL;
+ }
strcpy(ctx->context.apn, apn);
Anyway, I have now fixed this in
d9cb969dcff649d33f97ceddac57163dfc9602db. Let me know if I broke something.
Regards,
-Denis