File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1388,11 +1388,15 @@ int8_t canardRxSubscribe(struct CanardInstance* const ins,
13881388 int8_t out = - CANARD_ERROR_INVALID_ARGUMENT ;
13891389 const size_t tk = (size_t ) transfer_kind ;
13901390
1391- if (port_id < PORT_ID_MINIMUM ) // port_id can't be over 65535 because it exceeds type unsigned short maximum value.
1391+ if (tk == 0 && port_id > CANARD_SUBJECT_ID_MAX )
13921392 {
1393- (void ) fprintf (stderr , "Invalid port: %d. Port should be within 49152 to 65535\n" , port_id );
1394- exit (EXIT_FAILURE );
1393+ return out ;
13951394 }
1395+ if (port_id > CANARD_SERVICE_ID_MAX )
1396+ {
1397+ return out ;
1398+ }
1399+
13961400 if ((ins != NULL ) && (out_subscription != NULL ) && (tk < CANARD_NUM_TRANSFER_KINDS ))
13971401 {
13981402 // 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