File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed
application/tom_modem/src Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ int sms_read(PROFILE_T *profile, void *transport_ptr)
117117 sms -> sms_pdu = (char * )malloc (strlen (pdu ));
118118 sms -> sender = (char * )malloc (PHONE_NUMBER_SIZE );
119119 sms -> sms_text = (char * )malloc (SMS_TEXT_SIZE );
120+ memset (sms -> sms_text , 0 , SMS_TEXT_SIZE );
120121 sms -> sms_index = get_sms_index (line );
121122 memcpy (sms -> sms_pdu , pdu , strlen (pdu ));
122123 int sms_len = decode_pdu (sms );
@@ -237,6 +238,7 @@ int sms_read_unread(PROFILE_T *profile, void *transport_ptr)
237238 sms -> sms_pdu = (char * )malloc (strlen (pdu ));
238239 sms -> sender = (char * )malloc (PHONE_NUMBER_SIZE );
239240 sms -> sms_text = (char * )malloc (SMS_TEXT_SIZE );
241+ memset (sms -> sms_text , 0 , SMS_TEXT_SIZE );
240242 sms -> sms_index = get_sms_index (line );
241243 memcpy (sms -> sms_pdu , pdu , strlen (pdu ));
242244 int sms_len = decode_pdu (sms );
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ int decode_pdu(SMS_T *sms)
117117 // UCS2
118118 sms -> type = SMS_CHARSET_UCS2 ;
119119 int offset = 0 ;
120- for (int i = skip_bytes ; i < SMS_TEXT_SIZE ; i += 2 )
120+ for (int i = skip_bytes ; i < sms_len ; i += 2 )
121121 {
122122 int ucs2_char = 0x000000FF & sms_text [i + 1 ];
123123 ucs2_char |= (0x0000FF00 & (sms_text [i ] << 8 ));
You can’t perform that action at this time.
0 commit comments