adamdebreceni commented on a change in pull request #964:
URL: https://github.com/apache/nifi-minifi-cpp/pull/964#discussion_r551912512
##########
File path: nanofi/include/sitetosite/CPeer.h
##########
@@ -79,15 +79,15 @@ static void setHostName(struct SiteToSiteCPeer * peer,
const char * hostname) {
peer->_host[host_len] = '\0';
peer->_url[host_len + 7] = ':';
if(peer->_port != 0) {
- snprintf(peer->_url + host_len + 8, 5, "%d", peer->_port);
+ snprintf(peer->_url + host_len + 8, 6, "%d", peer->_port);
}
return;
}
static void setPort(struct SiteToSiteCPeer * peer, uint16_t port) {
peer->_port = port;
if(peer->_url != NULL) {
- int i;
+ size_t i;
for(i = strlen(peer->_url) -1; i >= 0; --i) { // look for the last ':' in
the string
Review comment:
won't this result in an infinite loop (or rather out of bound indexing),
if the `_url` does not contain a `:`?
----------------------------------------------------------------
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]