edgexfoundry / device-onvif-camera

Owner: Device WG
Apache License 2.0
29 stars 37 forks source link

fix: Ensures that the parsed value is within the bounds of int32 #475

Closed weichou1229 closed 6 days ago

weichou1229 commented 6 days ago

Fixes https://github.com/edgexfoundry/device-onvif-camera/security/code-scanning/2

To fix the problem, we need to ensure that the integer value parsed from the string is within the bounds of int32 before converting it. This can be done by using strconv.ParseInt with a bit size of 32, which directly parses the string into an int32 value, or by adding explicit bounds checks before the conversion.

In this case, we will use strconv.ParseInt with a bit size of 32 to parse the MessageLimit value. This ensures that the parsed value is within the bounds of int32.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

codecov-commenter commented 6 days ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 32.74%. Comparing base (124a5f1) to head (22d23d7).

Files with missing lines Patch % Lines
internal/driver/subscriptionrequest.go 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #475 +/- ## ========================================== - Coverage 32.76% 32.74% -0.02% ========================================== Files 21 21 Lines 1923 1924 +1 ========================================== Hits 630 630 - Misses 1217 1218 +1 Partials 76 76 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.