$OpenBSD: patch-socks4_c,v 1.3 2010/05/24 22:17:03 espie Exp $ --- socks4.c.orig Sat Oct 31 04:58:47 1998 +++ socks4.c Sat May 22 16:47:48 2010 @@ -88,7 +88,7 @@ socks4_connect(struct gateway *gw, struct http_request /* build a socks request for connection to the web server */ - strcpy((char *)&(c->userid), socks_userid); + strlcpy((char *)&(c->userid), socks_userid, sizeof(cbuf)); csiz = sizeof(*c) + sizeof(socks_userid) - 1; @@ -103,7 +103,7 @@ socks4_connect(struct gateway *gw, struct http_request errno = EINVAL; return(-1); } - strcpy(((char *)cbuf) + csiz, http->host); + strlcpy(((char *)cbuf) + csiz, http->host, sizeof(cbuf)); csiz = n; break; } @@ -162,7 +162,7 @@ socks4_connect(struct gateway *gw, struct http_request default: errstr = (char *) cbuf; errno = ENOENT; - sprintf(errstr, + snprintf(errstr, sizeof(cbuf), "SOCKS request rejected for reason code %d\n", s->cd); }