--- mod_http.c.orig 2005-11-18 12:51:26.000000000 +0200 +++ mod_http.c 2005-11-18 13:04:24.000000000 +0200 @@ -913,13 +913,14 @@ int len = strlen(s); int i = 0; int j = 0; - char *buf = (char *)malloc(len); - char ascii[2]; + char *buf = (char *)malloc(len + 1); + char ascii[3]; + ascii[2] = '\0'; while (i < len) { - if (s[i] == '%') { + if ((s[i] == '%') && (i + 2 < len)) { ascii[0] = s[i+1]; ascii[1] = s[i+2]; - buf[j++] = atoi(ascii); + buf[j++] = strtol(ascii, (char **)NULL, 16); i = i+3; } else { buf[j++] = s[i]; @@ -1645,13 +1646,15 @@ if (ptp->addr_pair.a_port == httpd_port) { ph->tcb_client = &ptp->b2a; ph->tcb_server = &ptp->a2b; + ph->pclient = FindClient(HostName(ptp->addr_pair.b_address)); } else { ph->tcb_client = &ptp->a2b; ph->tcb_server = &ptp->b2a; + ph->pclient = FindClient(HostName(ptp->addr_pair.a_address)); } /* attach the client info */ - ph->pclient = FindClient(HostName(ptp->addr_pair.a_address)); + //ph->pclient = FindClient(HostName(ptp->addr_pair.a_address)); return(ph); }