From: hno <> Date: Sat, 13 Apr 2002 20:16:04 +0000 (+0000) Subject: Bugzilla #207: Abort requests becoming too large for us to handle X-Git-Tag: SQUID_3_0_PRE1~1093 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=adcceb47187a4b211afe02264274bf8bd25616d8;p=thirdparty%2Fsquid.git Bugzilla #207: Abort requests becoming too large for us to handle (2GB on 32bit machines) --- diff --git a/configure.in b/configure.in index cbb11275c4..c6ccb01854 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/src/client_side.cc b/src/client_side.cc index 7c3a8ed7e8..e7e719b5cd 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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 diff --git a/src/store_swapout.cc b/src/store_swapout.cc index e4f2e2dc64..04974ffb31 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -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))