From: Fabian Keil Date: Fri, 18 Nov 2011 23:53:26 +0000 (+0000) Subject: Remove an incorrect string termination attempt X-Git-Tag: v_3_0_18~12 X-Git-Url: http://www.privoxy.org/gitweb/user-manual/quickstart.html?a=commitdiff_plain;h=0b2f8bed5cd5f8ea2c0a041fe0e3b5395cc31ba6;p=privoxy.git Remove an incorrect string termination attempt It could cause segmentations faults when Privoxy was compiled without RFC2553 support as *port[NI_MAXSERV - 1] isn't actually the last position in the allocated memory region. Given that snprintf() already produces a proper string the attempt can simply be discarded. The bug was introduced in 1.105 and is thus not relevant for the ChangeLog. --- diff --git a/jbsockets.c b/jbsockets.c index 7c3ab071..eb547068 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -1,4 +1,4 @@ -const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.108 2011/07/30 15:12:02 fabiankeil Exp $"; +const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.109 2011/09/04 11:10:56 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $ @@ -1006,7 +1006,6 @@ void get_host_information(jb_socket afd, char **ip_address, char **port, #else *ip_address = strdup(inet_ntoa(server.sin_addr)); snprintf(*port, NI_MAXSERV, "%hu", ntohs(server.sin_port)); - *port[NI_MAXSERV - 1] = '\0'; #endif /* HAVE_RFC2553 */ if (NULL == hostname) {