Coder Social home page Coder Social logo

Comments (3)

clalancette avatar clalancette commented on August 27, 2024

I'm not 100% sure yet, but I think the problem is this line:

size_t written = __rcutils_copy_string(offset, bytes_left, error_state->message);
.

The arguments to rcutils_copy_string are the destination pointer, the destination size, and the source pointer. In this case, the destination size is bytes_left, which is set to sizeof(error_string->str) in the previous line. However, there is no guarantee that the source has that many bytes to give. Now, I agree with you that this kind of defeats the purpose of the strnlen, so this is probably a false positive. Nevertheless, we can probably be defensive there and use the smaller of sizeof(error_string->str) and sizeof(error_state->message) as the bytes_left. I think that will get rid of the warning.

Do you want to try that out, or would you like me to poke at it more (I'm happy to do either)?

from rcutils.

Blast545 avatar Blast545 commented on August 27, 2024

I can try it out! I'll open a draft PR and check.

from rcutils.

Blast545 avatar Blast545 commented on August 27, 2024

Closed with #353

Reference newer case without the warning:
https://ci.ros2.org/view/packaging/job/packaging_linux/2572/

from rcutils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.