From: Zdeněk Šustr Date: Wed, 25 May 2011 11:32:30 +0000 (+0000) Subject: Throw error for HTTP requests longer than allocated buffer. X-Git-Tag: glite-lb-client_R_4_1_10_1~13 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=29dfa482aa5c461228706ad3ced42a652dab925b;p=jra1mw.git Throw error for HTTP requests longer than allocated buffer. (The error is not handled properly, yet. Connection just times out) --- diff --git a/org.glite.lb.common/src/mini_http.c b/org.glite.lb.common/src/mini_http.c index 0788cdf..8697fb6 100644 --- a/org.glite.lb.common/src/mini_http.c +++ b/org.glite.lb.common/src/mini_http.c @@ -86,6 +86,14 @@ edg_wll_ErrorCode edg_wll_http_recv(edg_wll_Context ctx,char **firstOut,char *** connPTR->bufUse += len; rdmore = 0; + if (connPTR->bufUse >= connPTR->bufSize) { + edg_wll_SetError(ctx,EINVAL,"HTTP Request too long"); + free(connPTR->buf); connPTR->buf = NULL; + connPTR->bufUse = 0; + connPTR->bufSize = 0; + goto error; + } + while (!rdmore && pstat != DONE) switch (pstat) { char *cr; @@ -181,7 +189,7 @@ edg_wll_ErrorCode edg_wll_http_recv_proxy(edg_wll_Context ctx,char **firstOut,ch if ( !ctx->connProxy->buf ) { ctx->connProxy->bufSize = BUFSIZ; ctx->connProxy->bufUse = 0; - ctx->connProxy->buf = malloc(BUFSIZ); + ctx->connProxy->buf = malloc(ctx->connProxy->bufSize); } do { diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index abc2ac3..d5d81b4 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -1447,7 +1447,6 @@ static int handle_server_error(edg_wll_Context ctx) int err,ret = 0; - errt = errd = NULL; switch ( (err = edg_wll_Error(ctx, &errt, &errd)) ) { case ETIMEDOUT: