diff --git a/mozilla/xpcom/ds/nsProperties.cpp b/mozilla/xpcom/ds/nsProperties.cpp index a53aa528f30..e04463a57a3 100644 --- a/mozilla/xpcom/ds/nsProperties.cpp +++ b/mozilla/xpcom/ds/nsProperties.cpp @@ -49,6 +49,8 @@ NS_INTERFACE_MAP_END NS_IMETHODIMP nsProperties::Get(const char* prop, const nsIID & uuid, void* *result) { + NS_ENSURE_ARG(prop); + nsCOMPtr value; if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) { return NS_ERROR_FAILURE; @@ -59,12 +61,16 @@ nsProperties::Get(const char* prop, const nsIID & uuid, void* *result) NS_IMETHODIMP nsProperties::Set(const char* prop, nsISupports* value) { + NS_ENSURE_ARG(prop); + return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP nsProperties::Undefine(const char* prop) { + NS_ENSURE_ARG(prop); + nsCOMPtr value; if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) return NS_ERROR_FAILURE; @@ -76,6 +82,8 @@ nsProperties::Undefine(const char* prop) NS_IMETHODIMP nsProperties::Has(const char* prop, PRBool *result) { + NS_ENSURE_ARG(prop); + nsCOMPtr value; *result = nsProperties_HashBase::Get(prop, getter_AddRefs(value)); @@ -108,10 +116,12 @@ GetKeysEnumerate(const char *key, nsISupports* data, NS_IMETHODIMP nsProperties::GetKeys(PRUint32 *count, char ***keys) { + NS_ENSURE_ARG(count); + NS_ENSURE_ARG(keys); + PRUint32 n = Count(); char ** k = (char **) nsMemory::Alloc(n * sizeof(char *)); - if (!k) - return NS_ERROR_OUT_OF_MEMORY; + NS_ENSURE_TRUE(k, NS_ERROR_OUT_OF_MEMORY); GetKeysEnumData gked; gked.keys = k; diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index c939b81b813..1512d7c6dc8 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -530,6 +530,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectorySer NS_IMETHODIMP nsDirectoryService::Undefine(const char* prop) { + NS_ENSURE_ARG(prop); + nsCStringKey key(prop); if (!mHashtable.Exists(&key)) return NS_ERROR_FAILURE; @@ -608,6 +610,8 @@ static PRBool FindProviderFile(nsISupports* aElement, void *aData) NS_IMETHODIMP nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result) { + NS_ENSURE_ARG(prop); + nsCStringKey key(prop); nsCOMPtr value = dont_AddRef(mHashtable.Get(&key)); @@ -656,6 +660,8 @@ nsDirectoryService::Get(const char* prop, const nsIID & uuid, void* *result) NS_IMETHODIMP nsDirectoryService::Set(const char* prop, nsISupports* value) { + NS_ENSURE_ARG(prop); + nsCStringKey key(prop); if (mHashtable.Exists(&key) || value == nsnull) return NS_ERROR_FAILURE; @@ -677,6 +683,8 @@ nsDirectoryService::Set(const char* prop, nsISupports* value) NS_IMETHODIMP nsDirectoryService::Has(const char *prop, PRBool *_retval) { + NS_ENSURE_ARG(prop); + *_retval = PR_FALSE; nsCOMPtr value; nsresult rv = Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(value));