Skip to content

Commit f3e9501

Browse files
author
Marcin Radomski
committed
Increase PDU buffer size to fit 8-bit-encoded hex string
1 parent cd7e6c9 commit f3e9501

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

features/cellular/framework/AT/AT_CellularSMS.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@ char *AT_CellularSMS::create_pdu(const char *phone_number, const char *message,
291291
// there might be need for padding so some more space
292292
totalPDULength += 2;
293293

294-
// message 7-bit padded and it will be converted to hex so it will take twice as much space
295-
totalPDULength += (message_length - (message_length / 8)) * 2;
294+
// 8-bit message, converted to hex so it will take twice as much space
295+
totalPDULength += message_length * 2;
296+
297+
// terminating nullbyte, because callers use strlen() to find out PDU size
298+
totalPDULength += 1;
296299

297300
char *pdu = new char[totalPDULength];
298301
memset(pdu, 0, totalPDULength);

0 commit comments

Comments
 (0)