From 14e71ac217c1feb46e62883dae89ec914aa2849b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 26 Apr 2010 16:27:01 -0400 Subject: [PATCH] Bug 559618. Treat negative max-age values as 0. r=jduell --- netwerk/protocol/http/src/nsHttpResponseHead.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/src/nsHttpResponseHead.cpp b/netwerk/protocol/http/src/nsHttpResponseHead.cpp index 451d90ec8072..7d98708275a9 100644 --- a/netwerk/protocol/http/src/nsHttpResponseHead.cpp +++ b/netwerk/protocol/http/src/nsHttpResponseHead.cpp @@ -534,7 +534,10 @@ nsHttpResponseHead::GetMaxAgeValue(PRUint32 *result) if (!p) return NS_ERROR_NOT_AVAILABLE; - *result = (PRUint32) atoi(p + 8); + int maxAgeValue = atoi(p + 8); + if (maxAgeValue < 0) + maxAgeValue = 0; + *result = PRUint32(maxAgeValue); return NS_OK; }