==8< atphttpd-0.4b.patch 8<== diff -u atphttpd-0.4b-old/atphttpd/http_handler.c atphttpd-0.4b/atphttpd/http_handler.c - --- atphttpd-0.4b-old/atphttpd/http_handler.c Sat Apr 22 05:05:57 2000 +++ atphttpd-0.4b/atphttpd/http_handler.c Fri Jul 12 13:20:16 2002 @@ -235,7 +235,7 @@ (void) sprintf(buffer, "%d %s\n

%d %s

\n", status, title, status, title ); sock_puts(hc[listnum].socket, buffer); - - (void) sprintf(buffer, "The following error occurred while trying to examine the garbage that you sent this poor webserver:
%s

\n", text ); + snprintf(buffer, sizeof(buffer), "The following error occurred while trying to examine the garbage that you sent this poor webserver:
%s

\n", text); sock_puts(hc[listnum].socket, buffer); (void) sprintf(buffer, "
\n
This cool page was automaticly generated by the trained rodents living inside the %s webserver.
\n\n", SERVER_URL, SERVER_NAME ); diff -u atphttpd-0.4b-old/atphttpd/main.c atphttpd-0.4b/atphttpd/main.c - --- atphttpd-0.4b-old/atphttpd/main.c Sat Apr 22 05:06:00 2000 +++ atphttpd-0.4b/atphttpd/main.c Fri Jul 12 13:30:55 2002 @@ -141,13 +141,11 @@ } } - - void deal_with_data(int listnum) { - - char buffer[MAX_BUFFER]; /* Buffer for socket reads */ - -// char *cur_char; /* Used in processing buffer */ - - char method[MAX_STORE], path[MAX_STORE], protocol[MAX_STORE]; - - - - if (sock_gets(hc[listnum].socket,buffer,MAX_BUFFER) < 0) { +void deal_with_data(int listnum) { + char buffer[MAX_BUFFER]; + char method[MAX_STORE], path[MAX_STORE], protocol[MAX_STORE]; + if (sock_gets(hc[listnum].socket, buffer, MAX_BUFFER - 1) < 0) { close(hc[listnum].socket); hc[listnum].socket = 0; } else { @@ -155,7 +153,7 @@ * * * Right now it is very dumb, and only checks for a get header * * Improvements? */ - - sscanf( buffer, "%[^ ] %[^ ] %[^ ]", method, path, protocol ); + sscanf(buffer, "%1023s %1023s %1023s", method, path, protocol); if ( strcasecmp( method, "get" ) == 0 || strcasecmp( method, "head" ) == 0) { strcpy(hc[listnum].path, path); ==8< atphttpd-0.4b.patch 8<==