Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIGURE_FLAGS := \
--disable-add-remove-context \
--disable-isimodem \
--disable-qmimodem \
--disable-upower \
--with-systemdunitdir=/usr/lib/systemd/system

%:
Expand Down
4 changes: 0 additions & 4 deletions ofono/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,6 @@ builtin_sources += plugins/sailfish_bt.c
endif
endif

if UPOWER
builtin_modules += upower
builtin_sources += plugins/upower.c
endif
endif

if NETTIME
Expand Down
6 changes: 3 additions & 3 deletions ofono/drivers/atmodem/sms.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
struct sms_data *data = ofono_sms_get_data(sms);
GAtResultIter iter;
const char *hexpdu;
unsigned char pdu[176];
unsigned char pdu[176] = {0};
long pdu_len;
int tpdu_len;

Expand Down Expand Up @@ -473,7 +473,7 @@ static void at_cmgr_notify(GAtResult *result, gpointer user_data)
struct sms_data *data = ofono_sms_get_data(sms);
GAtResultIter iter;
const char *hexpdu;
unsigned char pdu[176];
unsigned char pdu[176] = {0};
long pdu_len;
int tpdu_len;

Expand Down Expand Up @@ -655,7 +655,7 @@ static void at_cmgl_notify(GAtResult *result, gpointer user_data)
struct sms_data *data = ofono_sms_get_data(sms);
GAtResultIter iter;
const char *hexpdu;
unsigned char pdu[176];
unsigned char pdu[176] = {0};
long pdu_len;
int tpdu_len;
int index;
Expand Down
5 changes: 4 additions & 1 deletion ofono/drivers/atmodem/ussd.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
const char *content;
int dcs;
enum sms_charset charset;
unsigned char msg[160];
unsigned char msg[160] = {0};
const unsigned char *msg_ptr = NULL;
long msg_len;

Expand All @@ -123,6 +123,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
if (!g_at_result_iter_next_number(&iter, &dcs))
dcs = 0;

if (strlen(content) > sizeof(msg) * 2)
goto out;

if (!cbs_dcs_decode(dcs, NULL, NULL, &charset, NULL, NULL, NULL)) {
ofono_error("Unsupported USSD data coding scheme (%02x)", dcs);
status = 4; /* Not supported */
Expand Down
5 changes: 4 additions & 1 deletion ofono/drivers/huaweimodem/ussd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
GAtResultIter iter;
int status, dcs;
const char *content;
unsigned char msg[160];
unsigned char msg[160] = {0};
const unsigned char *msg_ptr = NULL;
long msg_len;

Expand All @@ -68,6 +68,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
if (!g_at_result_iter_next_number(&iter, &dcs))
dcs = 0;

if (strlen(content) > sizeof(msg) * 2)
goto out;

msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg);

out:
Expand Down
5 changes: 4 additions & 1 deletion ofono/drivers/speedupmodem/ussd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
GAtResultIter iter;
int status, dcs;
const char *content;
unsigned char msg[160];
unsigned char msg[160] = {0};
const unsigned char *msg_ptr = NULL;
long msg_len;

Expand All @@ -67,6 +67,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
if (!g_at_result_iter_next_number(&iter, &dcs))
dcs = 0;

if (strlen(content) > sizeof(msg) * 2)
goto out;

msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg);

out:
Expand Down
15 changes: 15 additions & 0 deletions ofono/src/smsutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,9 @@ static gboolean decode_deliver(const unsigned char *pdu, int len,

expected = sms_udl_in_bytes(out->deliver.udl, out->deliver.dcs);

if (expected < 0 || expected > (int)sizeof(out->deliver.ud))
return FALSE;

if ((len - offset) < expected)
return FALSE;

Expand Down Expand Up @@ -1087,6 +1090,9 @@ static gboolean decode_status_report(const unsigned char *pdu, int len,
if ((len - offset) < expected)
return FALSE;

if (expected > (int)sizeof(out->status_report.ud))
return FALSE;

memcpy(out->status_report.ud, pdu + offset, expected);
}

Expand Down Expand Up @@ -1236,10 +1242,16 @@ static gboolean decode_deliver_report(const unsigned char *pdu, int len,
return FALSE;

if (out->type == SMS_TYPE_DELIVER_REPORT_ERROR) {
if (expected > (int) sizeof(out->deliver_err_report.ud))
return FALSE;

out->deliver_err_report.udl = udl;
memcpy(out->deliver_err_report.ud,
pdu + offset, expected);
} else {
if (expected > (int) sizeof(out->deliver_ack_report.ud))
return FALSE;

out->deliver_ack_report.udl = udl;
memcpy(out->deliver_ack_report.ud,
pdu + offset, expected);
Expand Down Expand Up @@ -1474,6 +1486,9 @@ static gboolean decode_command(const unsigned char *pdu, int len,
if ((len - offset) < out->command.cdl)
return FALSE;

if (out->command.cdl > sizeof(out->command.cd))
return FALSE;

memcpy(out->command.cd, pdu + offset, out->command.cdl);

return TRUE;
Expand Down
16 changes: 16 additions & 0 deletions ofono/src/stkutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,10 @@ static bool parse_dataobj_frame_layout(struct comprehension_tlv_iter *iter,

fl->layout = data[0];
fl->len = len - 1;

if (fl->len > sizeof(fl->size))
return false;

memcpy(fl->size, data + 1, fl->len);

return true;
Expand Down Expand Up @@ -1909,6 +1913,10 @@ static bool parse_dataobj_mms_reference(struct comprehension_tlv_iter *iter,

data = comprehension_tlv_iter_get_data(iter);
mr->len = len;

if (len > sizeof(mr->ref))
return false;

memcpy(mr->ref, data, len);

return true;
Expand All @@ -1927,6 +1935,10 @@ static bool parse_dataobj_mms_id(struct comprehension_tlv_iter *iter,

data = comprehension_tlv_iter_get_data(iter);
mi->len = len;

if (len > sizeof(mi->id))
return false;

memcpy(mi->id, data, len);

return true;
Expand Down Expand Up @@ -1963,6 +1975,10 @@ static bool parse_dataobj_mms_content_id(

data = comprehension_tlv_iter_get_data(iter);
mci->len = len;

if (len > sizeof(mci->id))
return false;

memcpy(mci->id, data, len);

return true;
Expand Down