summaryrefslogtreecommitdiff
path: root/security/nss/lib/nss
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-05-03 20:59:50 +0000
committerwtc%netscape.com <devnull@localhost>2002-05-03 20:59:50 +0000
commit4d91a9b253454544baea013d51d732c907cf0593 (patch)
tree84085f6a9198512c4bc65dfe1d27e386c0f524d5 /security/nss/lib/nss
parent4a4319f35f4f37e8f0f16537f9a9fea9cf5d6d1b (diff)
parenta1639141f0ed4160359cf74705d49a6b9d3296df (diff)
downloadnss-hg-4d91a9b253454544baea013d51d732c907cf0593.tar.gz
Bugzilla bug 136279: fixed bugs where 'path' and 'oldpath' were passed
to string functions before they were null-terminated. Added a comment to explain what 'oldpath' is for.
Diffstat (limited to 'security/nss/lib/nss')
-rw-r--r--security/nss/lib/nss/nssinit.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/security/nss/lib/nss/nssinit.c b/security/nss/lib/nss/nssinit.c
index f5fb0f161..627e5efc2 100644
--- a/security/nss/lib/nss/nssinit.c
+++ b/security/nss/lib/nss/nssinit.c
@@ -298,16 +298,17 @@ static void nss_FindExternalRootPaths(const char *dbpath, const char* secmodpref
if (path[path_len-1] != FILE_SEP) {
path[path_len++] = FILE_SEP;
}
- PORT_Strcpy(oldpath, path);
+ PORT_Memcpy(oldpath,path,path_len);
PORT_Strcpy(&path[path_len],dllname);
if (secmodprefix) {
lastsep = PORT_Strrchr(secmodprefix, FILE_SEP);
if (lastsep) {
- PORT_Strncpy(&oldpath[path_len],secmodprefix,
- lastsep-secmodprefix+1); /* FILE_SEP */
+ int secmoddir_len = lastsep-secmodprefix+1; /* FILE_SEP */
+ PORT_Memcpy(&oldpath[path_len],secmodprefix,secmoddir_len);
+ path_len += secmoddir_len;
}
}
- PORT_Strcat(oldpath, dllname);
+ PORT_Strcpy(&oldpath[path_len],dllname);
*retoldpath = oldpath;
*retnewpath = path;
return;
@@ -328,6 +329,12 @@ nss_FindExternalRoot(const char *dbpath, const char* secmodprefix)
{
char *path = NULL;
char *oldpath = NULL;
+
+ /*
+ * 'oldpath' is the external root path in NSS 3.3.x or older.
+ * For backward compatibility we try to load the root certs
+ * module with the old path first.
+ */
nss_FindExternalRootPaths(dbpath, secmodprefix, &oldpath, &path);
if (oldpath) {
(void) SECMOD_AddNewModule("Root Certs",oldpath, 0, 0);