Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: nss/lib/util/utilmod.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: nss/lib/util/utilmod.c
diff --git a/nss/lib/util/utilmod.c b/nss/lib/util/utilmod.c
index 0f5970f1111a52179089ed07337ec1e31f8de66a..4be99ade2f86fea3dd68a27ad45d8d7535fa9080 100644
--- a/nss/lib/util/utilmod.c
+++ b/nss/lib/util/utilmod.c
@@ -75,14 +75,15 @@
/*
* Smart string cat functions. Automatically manage the memory.
- * The first parameter is the source string. If it's null, we
+ * The first parameter is the destination string. If it's null, we
* allocate memory for it. If it's not, we reallocate memory
* so the the concanenated string fits.
*/
static char *
nssutil_DupnCat(char *baseString, const char *str, int str_len)
{
- int len = (baseString ? PORT_Strlen(baseString) : 0) + 1;
+ int baseStringLen = baseString ? PORT_Strlen(baseString) : 0;
+ int len = baseStringLen + 1;
char *newString;
len += str_len;
@@ -91,8 +92,9 @@ nssutil_DupnCat(char *baseString, const char *str, int str_len)
PORT_Free(baseString);
return NULL;
}
- if (baseString == NULL) *newString = 0;
- return PORT_Strncat(newString,str, str_len);
+ PORT_Memcpy(&newString[baseStringLen], str, str_len);
+ newString[len - 1] = 0;
+ return newString;
}
/* Same as nssutil_DupnCat except it concatenates the full string, not a
@@ -480,7 +482,7 @@ nssutil_DeleteSecmodDBEntry(const char *appName,
char *block = NULL;
char *name = NULL;
char *lib = NULL;
- int name_len, lib_len;
+ int name_len = 0, lib_len = 0;
PRBool skip = PR_FALSE;
PRBool found = PR_FALSE;
« nss/lib/util/pkcs11n.h ('K') | « nss/lib/util/secport.c ('k') | nss/lib/util/utilpars.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698