From 17a0bbda335ffc9af34be1000f500c622008458c Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 21 Feb 2011 05:55:09 +0000 Subject: [PATCH] 3026. [bug] lib/isc/httpd.c: check that we have enough space after calling grow_headerspace() and if not re-call grow_headerspace() until we do. [RT #22521] --- CHANGES | 4 ++++ lib/isc/httpd.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index ead9a9c4e6..3368f4c428 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3026. [bug] lib/isc/httpd.c: check that we have enough space + after calling grow_headerspace() and if not + re-call grow_headerspace() until we do. [RT #22521] + 3025. [bug] Fixed a possible deadlock due to zone resigning. [RT #22964] diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 907a275dde..6d88d2c1cb 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: httpd.c,v 1.20 2010/11/16 05:38:31 marka Exp $ */ +/* $Id: httpd.c,v 1.21 2011/02/21 05:55:09 marka Exp $ */ /*! \file */ @@ -821,7 +821,7 @@ isc_httpd_response(isc_httpd_t *httpd) needlen += 3 + 1; /* room for response code, always 3 bytes */ needlen += strlen(httpd->retmsg) + 2; /* return msg + CRLF */ - if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { + while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { result = grow_headerspace(httpd); if (result != ISC_R_SUCCESS) return (result); @@ -846,7 +846,7 @@ isc_httpd_addheader(isc_httpd_t *httpd, const char *name, needlen += 2 + strlen(val); /* : and val */ needlen += 2; /* CRLF */ - if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { + while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { result = grow_headerspace(httpd); if (result != ISC_R_SUCCESS) return (result); @@ -869,7 +869,7 @@ isc_httpd_endheaders(isc_httpd_t *httpd) { isc_result_t result; - if (isc_buffer_availablelength(&httpd->headerbuffer) < 2) { + while (isc_buffer_availablelength(&httpd->headerbuffer) < 2) { result = grow_headerspace(httpd); if (result != ISC_R_SUCCESS) return (result); @@ -893,7 +893,7 @@ isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val) { needlen += 2 + strlen(buf); /* : and val */ needlen += 2; /* CRLF */ - if (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { + while (isc_buffer_availablelength(&httpd->headerbuffer) < needlen) { result = grow_headerspace(httpd); if (result != ISC_R_SUCCESS) return (result);