File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
features/cellular/framework/targets/QUECTEL/BC95 Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 19
19
#include " CellularUtil.h"
20
20
#include " CellularLog.h"
21
21
22
+ #define PACKET_SIZE_MAX 1358
23
+
22
24
using namespace mbed ;
23
25
using namespace mbed_cellular_util ;
24
26
@@ -174,6 +176,10 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
174
176
{
175
177
int sent_len = 0 ;
176
178
179
+ if (size > PACKET_SIZE_MAX) {
180
+ return NSAPI_ERROR_PARAMETER;
181
+ }
182
+
177
183
char *hexstr = new char [size * 2 + 1 ];
178
184
int hexlen = char_str_to_hex_str ((const char *)data, size, hexstr);
179
185
// NULL terminated for write_string
@@ -220,7 +226,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_recvfrom_impl(CellularS
220
226
221
227
_at.cmd_start (" AT+NSORF=" );
222
228
_at.write_int (socket->id );
223
- _at.write_int (size);
229
+ _at.write_int (size <= PACKET_SIZE_MAX ? size : PACKET_SIZE_MAX );
224
230
_at.cmd_stop ();
225
231
_at.resp_start ();
226
232
// receiving socket id
You can’t perform that action at this time.
0 commit comments