Skip to content
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

Possible access to dangling pointer in yarpbroker.cpp #3105

Open
S-Dafarra opened this issue Apr 17, 2024 · 0 comments
Open

Possible access to dangling pointer in yarpbroker.cpp #3105

S-Dafarra opened this issue Apr 17, 2024 · 0 comments

Comments

@S-Dafarra
Copy link
Contributor

Describe the bug
While reading the code to understand the issue behind #3104, I came across a warning by the Visual Studio static analyzer.

In particular, the following lines

Bottle msg, response;
msg.fromString(request);
ret = port.write(msg, response);
NetworkBase::disconnect(port.getName(), szport);
if(!response.size() || !ret) {
port.close();
return nullptr;
}
port.close();
return response.toString().c_str();

return a pointer to the char buffer of a temporary string.

Configuration (please complete the following information):

  • OS:
  • yarp version: 3.9.0
  • compiler:

Additional context
Add any other context about the problem here.

cc @randaz81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant