From 14d285bdcd1169ce7af5621a02488b2b3dcbc6b1 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Mon, 1 Aug 2016 04:12:00 +0200 Subject: [PATCH] Bug 1171203 - Fix redirection limit underflow, don't count internal redirect to this limit, r=mcmanus --- netwerk/protocol/http/HttpBaseChannel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index a7c3e9a58fb9..f809889d182a 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -2973,7 +2973,11 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI, httpChannel->SetAllowPipelining(mAllowPipelining); httpChannel->SetAllowSTS(mAllowSTS); // convey the new redirection limit - httpChannel->SetRedirectionLimit(mRedirectionLimit - 1); + // make sure we don't underflow + uint32_t redirectionLimit = mRedirectionLimit + ? mRedirectionLimit - 1 + : 0; + httpChannel->SetRedirectionLimit(redirectionLimit); // convey the Accept header value {