Skip to content

Commit 1245c14

Browse files
Jari PoyhonenJari Poyhonen
authored andcommitted
Pull request feedback fix: user_data_tx accepts arbitary size
1 parent 03432a0 commit 1245c14

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

features/cellular/framework/mux/cellular_mux.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,14 +1140,18 @@ void Mux::tx_noretransmit_entry_run()
11401140

11411141
ssize_t Mux::user_data_tx(uint8_t dlci_id, const void* buffer, size_t size)
11421142
{
1143-
MBED_ASSERT(size <=
1144-
(MBED_CONF_MUX_BUFFER_SIZE - (FRAME_START_READ_LEN + FRAME_HEADER_READ_LEN + FRAME_TRAILER_LEN)));
11451143
MBED_ASSERT(buffer != NULL);
11461144

11471145
if (size == 0) {
11481146
return 0;
11491147
}
11501148

1149+
const size_t max_payload_size = (MBED_CONF_MUX_BUFFER_SIZE -
1150+
(FRAME_START_READ_LEN + FRAME_HEADER_READ_LEN + FRAME_TRAILER_LEN));
1151+
if (size > max_payload_size) {
1152+
size = max_payload_size;
1153+
}
1154+
11511155
_mutex.lock();
11521156

11531157
ssize_t write_ret;

0 commit comments

Comments
 (0)