From 87cb7c145ece9cdf273d2b19afabbe8ab4e6e393 Mon Sep 17 00:00:00 2001 From: Nathan Bryant Date: Sat, 5 Dec 1998 05:27:02 +0000 Subject: [PATCH] * context_loop.c: moved the monster 64k buffer array off the stack * tcp_sockets.c: getservbyname() doesn't set errno. --- webcit/ChangeLog | 2 ++ webcit/context_loop.c | 8 +++++++- webcit/tcp_sockets.c | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 5b22d0288..d6189ddc4 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -3,6 +3,8 @@ and port * converted to autoconf and began port to Digital UNIX * warning fixes + * context_loop.c: moved the monster 64k buffer array off the stack + * tcp_sockets.c: getservbyname() doesn't set errno. 1998-12-03 Nathan Bryant * webserver.c: warning fix diff --git a/webcit/context_loop.c b/webcit/context_loop.c index a82c583e9..fbb3bd0cd 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -91,7 +91,7 @@ extern const char *defaultport; * This loop gets called once for every HTTP connection made to WebCit. */ void *context_loop(int sock) { - char req[256][256]; + char (*req)[256]; char buf[256], hold[256]; int num_lines = 0; int a; @@ -103,6 +103,12 @@ void *context_loop(int sock) { int ContentLength; int CloseSession = 0; + if ((req = malloc(sizeof(char[256][256]))) == NULL) { + printf("Can't malloc buffers; dropping connection.\n"); + close (sock); + return NULL; + } + printf("Reading request from socket %d\n", sock); /* diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 698bc6835..e22a99517 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -51,8 +51,7 @@ int connectsock(char *host, char *service, char *protocol) sin.sin_port = pse->s_port; } else if ((sin.sin_port = htons((u_short)atoi(service))) == 0) { - fprintf(stderr,"can't get %s service entry: %s\n", - service,strerror(errno)); + fprintf(stderr,"can't get %s service entry\n", service); return(-1); } -- 2.30.2