diff options
-rw-r--r-- | src/pdu_decode.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 643fa15..cbc2009 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -204,7 +204,21 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu) } if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) { - for (i = 0; i < pdu->user_data_len; i++) { + // Keep UDH for concatenated SMS. + // Otherwise it is impossible to process correctly concatenated SMS. + i = 0; + if (pdu->type.user_data_header) { + for (i = 0; i <= octets[0]; ++i) { + pdu->user_data[i] = octets[i]; + } + i = octets[0] + 1; // Set message text start after UDH. + // Process octets padding for 7-bit encoding. + if (0 != (i * 8) % 7) { + pdu->user_data[i] = 0; // set padding data to 0; + i++; + } + } + for (; i < pdu->user_data_len; i++) { pdu->user_data[i] = decode_septet(octets, i); } pdu->user_data[i] = '\0'; |