Bug 1344558 - Avoid OOM in nsSimpleURI::SetPath r=mcmanus
MozReview-Commit-ID: JWlN5Q6H59Q
--- a/netwerk/base/nsSimpleURI.cpp
+++ b/netwerk/base/nsSimpleURI.cpp
@@ -419,17 +419,20 @@ nsSimpleURI::GetPath(nsACString &result)
return NS_OK;
}
NS_IMETHODIMP
nsSimpleURI::SetPath(const nsACString &aPath)
{
NS_ENSURE_STATE(mMutable);
- nsAutoCString path(aPath);
+ nsAutoCString path;
+ if (!path.Assign(aPath, fallible)) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
int32_t queryPos = path.FindChar('?');
int32_t hashPos = path.FindChar('#');
if (queryPos != kNotFound && hashPos != kNotFound && hashPos < queryPos) {
queryPos = kNotFound;
}
nsAutoCString query;