sim: No need for this define
authorDenis Kenzior <denkenz@gmail.com>
Thu, 20 May 2010 04:47:41 +0000 (23:47 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Thu, 20 May 2010 04:47:41 +0000 (23:47 -0500)
include/types.h
src/sim.c

index adaf319..2b154f0 100644 (file)
@@ -36,8 +36,6 @@ extern "C" {
 
 typedef int            ofono_bool_t;
 
-#define OFONO_MAX_ICCID_LENGTH 20
-
 /* MCC is always three digits. MNC is either two or three digits */
 #define OFONO_MAX_MCC_LENGTH 3
 #define OFONO_MAX_MNC_LENGTH 3
index f37ffb3..942fd0b 100644 (file)
--- a/src/sim.c
+++ b/src/sim.c
@@ -1304,13 +1304,13 @@ static void sim_iccid_read_cb(int ok, int length, int record,
        struct ofono_sim *sim = userdata;
        const char *path = __ofono_atom_get_path(sim->atom);
        DBusConnection *conn = ofono_dbus_get_connection();
-       char iccid[OFONO_MAX_ICCID_LENGTH + 1];
+       char iccid[21]; /* ICCID max length is 20 + 1 for NULL */
 
        if (!ok || length < 10)
                return;
 
        extract_bcd_number(data, length, iccid);
-       iccid[OFONO_MAX_ICCID_LENGTH] = '\0';
+       iccid[20] = '\0';
        sim->iccid = g_strdup(iccid);
 
        ofono_dbus_signal_property_changed(conn, path,