summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-05-03 21:02:45 +0000
committerwtc%netscape.com <devnull@localhost>2002-05-03 21:02:45 +0000
commit8001bfb261a677ef1924a26c36ca552dba86e959 (patch)
tree7687bb88a421b20f7dbe96c44c519848bbbf4f5e
parent3b9ba472163f92c613d00d2691b25f1e2cb699b2 (diff)
downloadnss-hg-8001bfb261a677ef1924a26c36ca552dba86e959.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. (Tag: NSS_3_4_BRANCH)
-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 edb13b17e..868173001 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);