* context_loop.c: moved the monster 64k buffer array off the stack
authorNathan Bryant <loanshark@uncensored.citadel.org>
Sat, 5 Dec 1998 05:27:02 +0000 (05:27 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Sat, 5 Dec 1998 05:27:02 +0000 (05:27 +0000)
        * tcp_sockets.c: getservbyname() doesn't set errno.

webcit/ChangeLog
webcit/context_loop.c
webcit/tcp_sockets.c

index 5b22d02883dbf4958bf5718afaa93f1a79641d31..d6189ddc477599ab297aa5f0ee07decd3b33be0e 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
index a82c583e9dbb59b33a21fd2bbc6a67ebc9a70c13..fbb3bd0cd8ad103bb1627e396510c89ece28b96e 100644 (file)
@@ -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);
 
        /*
index 698bc6835fddd05d9d3522153fb3f679de9a8597..e22a99517e5c9137110a4c0444bf205841ec019a 100644 (file)
@@ -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);
                }