diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c index 5513932d..c51b1d49 100644 --- a/drivers/atmodem/sim.c +++ b/drivers/atmodem/sim.c @@ -305,7 +305,7 @@ static void at_sim_update_file(struct ofono_sim *sim, int cmd, int fileid, struct sim_data *sd = ofono_sim_get_data(sim); struct cb_data *cbd = cb_data_new(cb, data); char *buf; - char *quote = ""; + gboolean quote = FALSE; int len, ret; int size = 36 + p3 * 2; @@ -317,7 +317,7 @@ static void at_sim_update_file(struct ofono_sim *sim, int cmd, int fileid, case OFONO_VENDOR_ZTE: case OFONO_VENDOR_HUAWEI: case OFONO_VENDOR_SPEEDUP: - quote = "\""; + quote = TRUE; size += 2; break; } @@ -326,13 +326,16 @@ static void at_sim_update_file(struct ofono_sim *sim, int cmd, int fileid, if (buf == NULL) goto error; - len = sprintf(buf, "AT+CRSM=%i,%i,%i,%i,%i,%s", cmd, fileid, - p1, p2, p3, quote); + len = sprintf(buf, "AT+CRSM=%i,%i,%i,%i,%i,", cmd, fileid,p1, p2, p3); + + if (quote) + buf[len++] = '\"'; for (; p3; p3--) len += sprintf(buf + len, "%02hhX", *value++); - sprintf(buf + len, "%s", quote); + if (quote) + buf[len++] = '\"'; ret = g_at_chat_send(sd->chat, buf, crsm_prefix, at_crsm_update_cb, cbd, g_free);