summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-12-02 07:53:54 -0600
committerDenis Kenzior <denkenz@gmail.com>2010-12-02 07:53:54 -0600
commitc5a42cfabe3abe0d99299daffbe04c33a217fb25 (patch)
tree2a09cc44599e49db131bc4fe8516e27d22c07d86
parentac72349017fbfdecbba000c0259cc6b99f0873ed (diff)
downloadofono-c5a42cfabe3abe0d99299daffbe04c33a217fb25.tar.bz2
smsutil: Fix uninitialized optional elements
sms_decode was never memsetting the returned structure, so if any optional elements were present in the SMS (e.g. status report) then the structure was not completely initialized.
-rw-r--r--src/smsutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/smsutil.c b/src/smsutil.c
index b06e9bf9..631d9496 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -1024,8 +1024,6 @@ static gboolean decode_status_report(const unsigned char *pdu, int len,
if (out->status_report.pi & 0x02) {
if (!next_octet(pdu, len, &offset, &out->status_report.dcs))
return FALSE;
- } else {
- out->status_report.dcs = 0;
}
if (out->status_report.pi & 0x04) {
@@ -1509,6 +1507,8 @@ gboolean sms_decode(const unsigned char *pdu, int len, gboolean outgoing,
if (len == 0)
return FALSE;
+ memset(out, 0, sizeof(*out));
+
if (tpdu_len < len) {
if (!sms_decode_address_field(pdu, len, &offset,
TRUE, &out->sc_addr))