openbsd-ports/www/privoxy/patches/patch-jcc_c

49 lines
1.9 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-jcc_c,v 1.2 2003/04/01 20:52:59 sturm Exp $
--- jcc.c.orig Mon Mar 17 11:48:59 2003
+++ jcc.c Sat Mar 29 19:10:14 2003
@@ -688,7 +688,7 @@ static int32 server_thread(void *data);
#define sleep(N) DosSleep(((N) * 100))
#endif
-#ifdef OSX_DARWIN
+#if defined(OSX_DARWIN) || defined(__OpenBSD__)
/*
* Hit OSX over the head with a hammer. Protect all *_r functions.
*/
@@ -886,7 +886,7 @@ static void chat(struct client_state *cs
if (http->cmd == NULL)
{
- strcpy(buf, CHEADER);
+ strlcpy(buf, CHEADER, sizeof(buf));
write_socket(csp->cfd, buf, strlen(buf));
log_error(LOG_LEVEL_CLF, "%s - - [%T] \" \" 400 0", csp->ip_addr_str);
@@ -966,7 +966,7 @@ static void chat(struct client_state *cs
|| (csp->action->flags & ACTION_LIMIT_CONNECT
&& !match_portlist(csp->action->string[ACTION_STRING_LIMIT_CONNECT], csp->http->port)) )
{
- strcpy(buf, CFORBIDDEN);
+ strlcpy(buf, CFORBIDDEN, sizeof(buf));
write_socket(csp->cfd, buf, strlen(buf));
log_error(LOG_LEVEL_CONNECT, "Denying suspicious CONNECT request from %s", csp->ip_addr_str);
@@ -1417,7 +1417,7 @@ static void chat(struct client_state *cs
* This is NOT the body, so
* Let's pretend the server just sent us a blank line.
*/
- len = sprintf(buf, "\r\n");
+ len = snprintf(buf, sizeof(buf), "\r\n");
/*
* Now, let the normal header parsing algorithm below do its
@@ -2438,7 +2438,7 @@ static void listen_loop(void)
log_error(LOG_LEVEL_ERROR, "can't fork: %E");
- sprintf(buf , "Privoxy: can't fork: errno = %d", errno);
+ snprintf(buf, sizeof(buf), "Privoxy: can't fork: errno = %d", errno);
write_socket(csp->cfd, buf, strlen(buf));
close_socket(csp->cfd);