Bug 527400 - Fix OOM null deref from bug 514872, r=jwalden+bmo, a=beltzner

--HG--
extra : rebase_source : 43a222a11bf131b8ef2420ef2d657c84ba452bb3
This commit is contained in:
Gijs Kruitbosch 2009-12-02 19:48:48 +01:00
parent 9fc75352b9
commit e37068a79b

View File

@ -422,9 +422,9 @@ ns_WildCardMatch(const T *str, const T *xp, PRBool case_insensitive)
return _shexp_match(str, xp, case_insensitive, 0);
expr = (T *) NS_Alloc((nsCharTraits<T>::length(xp) + 1) * sizeof(T));
memcpy(expr, xp, (nsCharTraits<T>::length(xp) + 1) * sizeof(T));
if(!expr)
return NOMATCH;
memcpy(expr, xp, (nsCharTraits<T>::length(xp) + 1) * sizeof(T));
x = ::_scan_and_copy(expr, T('~'), T('\0'), static_cast<T*>(NULL));
if (x != ABORTED && expr[x] == '~') {