Hi,
Thanks for the response. We fixed the issue related to casting and still didnt see any change in behavior where intermittently garbage values are being appended.
However, when we tried to get the ip address using alternate means, as follows the issue is not happening and Valgrind is also not reporting any issue:
struct sockaddr_in *sin = (struct sockaddr_in *)r->connection->sockaddr;
char *ip = apr_palloc(conf->pool, sizeof(char)*INET_ADDRSTRLEN);
inet_ntop(AF_INET, &(sin->sin_addr), ip, INET_ADDRSTRLEN);
Can you please suggest if there is any issue in earlier approach and using sockaddr is preferable approach?