songgaoye opened a new pull request, #3728:
URL: https://github.com/apache/brpc/pull/3728
### What problem does this PR solve?
Issue Number: resolve
Problem Summary:
UB shared-memory names are assembled with `snprintf`, but the previous code
only handled negative return values. A too-long endpoint name silently
truncates
the generated name, which can cause a connection to use an unintended shared
memory object or collide with another name.
### What is changed and the side effects?
Changed:
- Treat `snprintf` truncation as an error when generating client and server
shared-memory names.
- Reject setup instead of using a truncated name.
- Release the allocated transaction slot when client local-name construction
fails.
- Add a unit test for rejecting an overlong local shared-memory name.
Side effects:
- Performance effects:
None on successful setup paths.
- Breaking backward compatibility:
Connections whose generated shared-memory names exceed the fixed name limit
now fall back instead of silently using a truncated name.
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]