File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 4242// The internal includes are placed here after the config header is included and CANARD_ASSERT is defined.
4343
4444#include "_canard_cavl.h"
45+ #include <stdio.h>
46+ #include <stdlib.h>
4547
4648// --------------------------------------------- COMMON DEFINITIONS ---------------------------------------------
4749
@@ -1384,6 +1386,13 @@ int8_t canardRxSubscribe(struct CanardInstance* const ins,
13841386{
13851387 int8_t out = - CANARD_ERROR_INVALID_ARGUMENT ;
13861388 const size_t tk = (size_t ) transfer_kind ;
1389+
1390+ assert (port_id >= 49152 && port_id <= 65535 );
1391+ if (port_id < 49152 || port_id > 65535 )
1392+ {
1393+ fprintf (stderr , "Invalid port: %d. Port should be within 49152 to 65535\n" , port_id );
1394+ exit (EXIT_FAILURE );
1395+ }
13871396 if ((ins != NULL ) && (out_subscription != NULL ) && (tk < CANARD_NUM_TRANSFER_KINDS ))
13881397 {
13891398 // Reset to the initial state. This is absolutely critical because the new payload size limit may be larger
You can’t perform that action at this time.
0 commit comments