]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bugzilla #207: Abort requests becoming too large for us to handle
authorhno <>
Sat, 13 Apr 2002 20:16:04 +0000 (20:16 +0000)
committerhno <>
Sat, 13 Apr 2002 20:16:04 +0000 (20:16 +0000)
(2GB on 32bit machines)

configure.in
src/client_side.cc
src/store_swapout.cc

index cbb11275c4594c83dd45eeb522315429eba6af4c..c6ccb01854faf5a105d4f5cbebeca39cf334dac6 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.262 2002/04/13 14:11:43 hno Exp $
+dnl  $Id: configure.in,v 1.263 2002/04/13 14:16:04 hno Exp $
 dnl
 dnl
 dnl
@@ -11,7 +11,7 @@ AC_INIT(src/main.c)
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 2.6-DEVEL)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.262 $)dnl
+AC_REVISION($Revision: 1.263 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -1365,6 +1365,9 @@ AC_CHECK_TYPE(off_t, int)
 AC_CHECK_TYPE(mode_t, u_short)
 AC_CHECK_TYPE(fd_mask, int)
 
+AC_CHECK_SIZEOF_SYSTYPE(off_t, 4)
+AC_CHECK_SIZEOF_SYSTYPE(size_t, 4)
+
 dnl Check for special functions
 AC_FUNC_ALLOCA
 
index 7c3a8ed7e8ff5b4dca9b1bf8d7068a81e0b512d3..e7e719b5cdd415534365afb8a10ca3953e6f17c5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.570 2002/04/11 22:05:53 hno Exp $
+ * $Id: client_side.cc,v 1.571 2002/04/13 14:16:04 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1749,6 +1749,25 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da
        if (isTcpHit(http->log_type))
            kb_incr(&statCounter.client_http.hit_kbytes_out, size);
     }
+#if SIZEOF_SIZE_T == 4
+    if (http->out.size > 0x7FFF0000) {
+       debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd);
+       debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn->peer.sin_addr));
+       debug(33, 1) ("\treceived %d bytes\n", http->out.size);
+       debug(33, 1) ("\tURI %s\n", http->log_uri);
+       comm_close(fd);
+    } else
+#endif
+#if SIZEOF_OFF_T == 4
+    if (http->out.offset > 0x7FFF0000) {
+       debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd);
+       debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn->peer.sin_addr));
+       debug(33, 1) ("\treceived %d bytes (offset %d)\n", http->out.size,
+           http->out.offset);
+       debug(33, 1) ("\tURI %s\n", http->log_uri);
+       comm_close(fd);
+    } else
+#endif
     if (errflag) {
        /*
         * just close the socket, httpRequestFree will abort if needed
index e4f2e2dc64def007e3133bd346756bd115ad5644..04974ffb31c17a92b6f91601b7ad86a44dab4785 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.85 2001/12/17 20:20:43 hno Exp $
+ * $Id: store_swapout.cc,v 1.86 2002/04/13 14:16:04 hno Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -185,6 +185,13 @@ storeSwapOut(StoreEntry * e)
     }
     stmemFreeDataUpto(&mem->data_hdr, new_mem_lo);
     mem->inmem_lo = new_mem_lo;
+#if SIZEOF_OFF_T == 4
+    if (mem->inmem_hi > 0x7FFF0000) {
+       debug(20, 0) ("WARNING: preventing off_t overflow for %s\n", storeUrl(e));
+       storeAbort(e);
+       return;
+    }
+#endif
     if (e->swap_status == SWAPOUT_WRITING)
        assert(mem->inmem_lo <= on_disk);
     if (!storeSwapOutAble(e))