File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -1388,12 +1388,9 @@ 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.
1392- {
1393- (void ) fprintf (stderr , "Invalid port: %d. Port should be within 49152 to 65535\n" , port_id );
1394- exit (EXIT_FAILURE );
1395- }
1396- if ((ins != NULL ) && (out_subscription != NULL ) && (tk < CANARD_NUM_TRANSFER_KINDS ))
1391+ if ((ins != NULL ) && (out_subscription != NULL ) && (tk < CANARD_NUM_TRANSFER_KINDS ) &&
1392+ ((transfer_kind == CanardTransferKindMessage && port_id <= CANARD_SUBJECT_ID_MAX ) ||
1393+ (port_id <= CANARD_SERVICE_ID_MAX )))
13971394 {
13981395 // Reset to the initial state. This is absolutely critical because the new payload size limit may be larger
13991396 // than the old value; if there are any payload buffers allocated, we may overrun them because they are shorter
You can’t perform that action at this time.
0 commit comments