empiredan commented on PR #2223: URL: https://github.com/apache/zookeeper/pull/2223#issuecomment-2748850389
> Looks good except possible `undefined` in `zoo_sasl_password_callback_t`. I think we probably should avoid `undefined` path from caller side. @kezhuw Thank you very much for helping review the code ! I completely agree that we should avoid undefined behavior. Instead of requiring users to remember to manually add a null terminator at the end, returning the actual password length is more user-friendly, helps draw attention, and prevents potential undefined behavior. As for the `buf_len` parameter, how about keeping it ? It mainly to remind users within the callback function that the buffer has a size limit and should not be accessed out of bounds. The stack memory allocation approach is still retained because: 1. Stack allocation is faster than heap allocation. 2. A length of 1023 is more than sufficient for SASL passwords. -- 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]
