nicob87 opened a new pull request #679: DISPATCH-1566: fix safe_snptrintf URL: https://github.com/apache/qpid-dispatch/pull/679 As it is explained in [DISPATCH-1566](https://issues.apache.org/jira/browse/DISPATCH-1566): "This function fails for size = 0, and ... inside it calls vsnprintf, without considering that in case of error vsnprintf returns a negative number." So after fix we can expect this behaviour: - (size = 0) -> safe_snprintf returns 0, and does nothing. - (size > INT_MAX) -> safe_snprintf returns 0, and does nothing. Since inner vsnprintf function returns int, it has no sense (and it may produce an error) to accept size > INT_MAX. - (inner vsnprintf return value > (size -1)) -> safe_snprintf returns (size-1) -> which is the max possible value. - (inner vsnprintf returns negative number) -> safe_snprintf returns 0. there was a parsing error. - (inner vsnprintf return value >= 0 and < (size-1)) -> safe_snprintf returns vsnprintf. This behaviour has been unit-tested but those changes will be included in other pr that is blocked by: [DISPATCH-1568](https://issues.apache.org/jira/browse/DISPATCH-1568)
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
