-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Return error if invalid input detected in transport layer (Send/Recv) #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aggarg
previously approved these changes
Jan 7, 2022
chinglee-iot
reviewed
Jan 7, 2022
| { | ||
| LogError( ( "invalid input, bytesToRecv == 0" ) ); | ||
| return -1; | ||
| } |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to add else case to comply with MISRA C:2012 rule 14.10.
| if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) ) | ||
| { | ||
| LogError( ( "invalid input, pNetworkContext=%p", pNetworkContext ) ); | ||
| return -1; |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to use a single point exit to comply with MISRA C:2012 rule 15.5.
chinglee-iot
approved these changes
Jan 7, 2022
n9wxu
approved these changes
Jan 10, 2022
johnrhen
pushed a commit
to johnrhen/FreeRTOS
that referenced
this pull request
Jan 24, 2022
…FreeRTOS#773) * return error if invalid input detected in transport layer
johnrhen
added a commit
that referenced
this pull request
Jul 20, 2022
* Create CloudFormation template for demo setup * Add CF_ prefix to CloudFormation-created resources to avoid collisions * Update lexicon.txt * Create initial python setup script * Create separate demo_cleanup.py file * Move setup items to DemoSetup folder * Add demo_config.h setup to the demo_setup.py script * Modify error logging on demo_setup.py * Add file cleanup to demo_cleanup.py * Rename convert_pem_to_der.py to convert_credentials_to_der.py * Adjust comment wording on demo_cleanup.py * added configUSE_TICKLESS_IDLE (#764) * Fix tests needed for FreeRTOS/FreeRTOS-Kernel#435 (#766) * Fix tests needed for FreeRTOS/FreeRTOS-Kernel#435 Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add tests to cover FreeRTOS/FreeRTOS-Kernel#435 (#768) Add tests to cover FreeRTOS/FreeRTOS-Kernel#435 This ensures that the coverage does not go down with the PR FreeRTOS/FreeRTOS-Kernel#435. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add tests to increase queue code coverage (#770) These tests cover the following portion in the queue code: static void prvUnlockQueue( Queue_t * const pxQueue ) { ... if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) { /* The queue is a member of a queue set, and posting to * the queue set caused a higher priority task to unblock. * A context switch is required. */ vTaskMissedYield(); } else { mtCOVERAGE_TEST_MARKER(); } ... } Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Update FreeRTOS-Kernel submodule pointer (#771) Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add new names to spell check dictionary (#772) * Return error if invalid input detected in transport layer (Send/Recv) (#773) * return error if invalid input detected in transport layer * Create mqtt_pkcs11_demo_helpers for AWS demos (#769) * Create mqtt_pkcs11_demo_helpers by modifying mqtt_demo_helpers * Update formatting and variable naming * Fix multi-line parameter formatting * Update file headers to match latest release version * GCC/Rx100 Demo project files update to e2 Studio v8 (#776) * Upgrade GCC project files for e2 studio v7.8.0 in Demo/RX100-RSK_GCC_e2studio folder * Update Demo project file to e2 Studio v8 and remove the .bat file. * Update the choice of toolchain version. * Update the link in file header. Co-authored-by: NoMaY (a user of Japan.RenesasRulz.com) <NoMaY-jp@outlook.com> * Update FreeRTOS-Cellular-Interface submodule pointer (#775) * Update cellular sub-module pointer * Add more log in cellular_setup.c to indicate error * Adjust cellular transport timeout value for demo application * Add default cellular module specific config in cellular_config.h * Create separate demo_cleanup.py file * Move setup items to DemoSetup folder * Add demo_config.h setup to the demo_setup.py script * Modify error logging on demo_setup.py * Add file cleanup to demo_cleanup.py * Rename convert_pem_to_der.py to convert_credentials_to_der.py * Adjust comment wording on demo_cleanup.py * Adjust comment wording on demo_config.h * Format files and reduce code redundancy * Update lexicon.txt * Remove preconfigured fields from demo_config,h * Update convert_credentials_to_der.py Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com> * Make python files executable Co-authored-by: Joseph Julicher <jjulicher@mac.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Ravishankar Bhagavandas <bhagavar@amazon.com> Co-authored-by: ActoryOu <jay2002824@gmail.com> Co-authored-by: Ming Yue <mingyue86010@gmail.com> Co-authored-by: NoMaY (a user of Japan.RenesasRulz.com) <NoMaY-jp@outlook.com> Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com>
every-breaking-wave
pushed a commit
to every-breaking-wave/FreeRTOS
that referenced
this pull request
Nov 15, 2024
* Support configurable RISC-V chip extension Added the FREERTOS_RISCV_EXTENSION option to allow the user to select which chip extension they want included. Removed the port for pulpino to instead use the new option. * Add port GCC_RISC_V_GENERIC and IAR_RISC_V_GENERIC * Add two rics-v generic ports to support FREERTOS_RISCV_EXTENSION config --------- Co-authored-by: Joe Benczarski <jbenczarski@trijicon.com> Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com> Co-authored-by: kar-rahul-aws <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Soren Ptak <ptaksoren@gmail.com>
Zangetsu112
pushed a commit
to Zangetsu112/FreeRTOS-evpp
that referenced
this pull request
Aug 18, 2025
…FreeRTOS#773) * return error if invalid input detected in transport layer
Zangetsu112
pushed a commit
to Zangetsu112/FreeRTOS-evpp
that referenced
this pull request
Aug 18, 2025
* Create CloudFormation template for demo setup * Add CF_ prefix to CloudFormation-created resources to avoid collisions * Update lexicon.txt * Create initial python setup script * Create separate demo_cleanup.py file * Move setup items to DemoSetup folder * Add demo_config.h setup to the demo_setup.py script * Modify error logging on demo_setup.py * Add file cleanup to demo_cleanup.py * Rename convert_pem_to_der.py to convert_credentials_to_der.py * Adjust comment wording on demo_cleanup.py * added configUSE_TICKLESS_IDLE (FreeRTOS#764) * Fix tests needed for FreeRTOS/FreeRTOS-Kernel#435 (FreeRTOS#766) * Fix tests needed for FreeRTOS/FreeRTOS-Kernel#435 Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add tests to cover FreeRTOS/FreeRTOS-Kernel#435 (FreeRTOS#768) Add tests to cover FreeRTOS/FreeRTOS-Kernel#435 This ensures that the coverage does not go down with the PR FreeRTOS/FreeRTOS-Kernel#435. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add tests to increase queue code coverage (FreeRTOS#770) These tests cover the following portion in the queue code: static void prvUnlockQueue( Queue_t * const pxQueue ) { ... if( prvNotifyQueueSetContainer( pxQueue ) != pdFALSE ) { /* The queue is a member of a queue set, and posting to * the queue set caused a higher priority task to unblock. * A context switch is required. */ vTaskMissedYield(); } else { mtCOVERAGE_TEST_MARKER(); } ... } Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Update FreeRTOS-Kernel submodule pointer (FreeRTOS#771) Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> * Add new names to spell check dictionary (FreeRTOS#772) * Return error if invalid input detected in transport layer (Send/Recv) (FreeRTOS#773) * return error if invalid input detected in transport layer * Create mqtt_pkcs11_demo_helpers for AWS demos (FreeRTOS#769) * Create mqtt_pkcs11_demo_helpers by modifying mqtt_demo_helpers * Update formatting and variable naming * Fix multi-line parameter formatting * Update file headers to match latest release version * GCC/Rx100 Demo project files update to e2 Studio v8 (FreeRTOS#776) * Upgrade GCC project files for e2 studio v7.8.0 in Demo/RX100-RSK_GCC_e2studio folder * Update Demo project file to e2 Studio v8 and remove the .bat file. * Update the choice of toolchain version. * Update the link in file header. Co-authored-by: NoMaY (a user of Japan.RenesasRulz.com) <NoMaY-jp@outlook.com> * Update FreeRTOS-Cellular-Interface submodule pointer (FreeRTOS#775) * Update cellular sub-module pointer * Add more log in cellular_setup.c to indicate error * Adjust cellular transport timeout value for demo application * Add default cellular module specific config in cellular_config.h * Create separate demo_cleanup.py file * Move setup items to DemoSetup folder * Add demo_config.h setup to the demo_setup.py script * Modify error logging on demo_setup.py * Add file cleanup to demo_cleanup.py * Rename convert_pem_to_der.py to convert_credentials_to_der.py * Adjust comment wording on demo_cleanup.py * Adjust comment wording on demo_config.h * Format files and reduce code redundancy * Update lexicon.txt * Remove preconfigured fields from demo_config,h * Update convert_credentials_to_der.py Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com> * Make python files executable Co-authored-by: Joseph Julicher <jjulicher@mac.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Ravishankar Bhagavandas <bhagavar@amazon.com> Co-authored-by: ActoryOu <jay2002824@gmail.com> Co-authored-by: Ming Yue <mingyue86010@gmail.com> Co-authored-by: NoMaY (a user of Japan.RenesasRulz.com) <NoMaY-jp@outlook.com> Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com> Co-authored-by: Archit Gupta <71798289+archigup@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Return error if invalid input detected in transport layer
Description
Check the input at *FreeRTOS_send/recv function and return negative value if input is invalid.
Test Steps
using_mbedtls_pcks11: corePKCS11_MQTT_Mutual_Auth_Windows_Simulator
using_mbedtls: FreeRTOS_Cellular_Interface_Windows_Simulator
using_plaintext: coreMQTT_Windows_Simulator/MQTT_Plain_Text
using_wolfSSL: coreMQTT_Windows_Simulator/MQTT_Mutual_Auth_wolfSSL
Related Issue
Refer to API reference
Openssl_Recv should return negative value when byteToRecv is 0.
Openssl_Send should return negative value when byteToSend is 0.
TransportRecv_t:
If no data is available on the network to read and no error has occurred, zero MUST be the return value. A zero return value SHOULD represent that the read operation can be retried by calling the API function. Zero MUST NOT be returned if a network disconnection has occurred.
TransportSend_t:
If no data is transmitted over the network due to a full TX buffer and no network error has occurred, this MUST return zero as the return value. A zero return value SHOULD represent that the send operation can be retried by calling the API function. Zero MUST NOT be returned if a network disconnection has occurred.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.