Closed Bug 265652 Opened 20 years ago Closed 20 years ago

Possible code cleanup of nsNSSCertificateDB and nsPKCS12Blob

Categories

(Core Graveyard :: Security: UI, defect)

Other Branch
x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

Details

Attachments

(1 file)

nsPKCS12Blob::ImportFromFileHelper's handling of strings is fairly disturbing,
as is nsPKCS12Blob::nickname_collision.

I've also made one change to nsNSSCertificateDB::ImportPKCS12File
Attached patch changesSplinter Review
Attachment #163040 - Flags: superreview?(darin)
Attachment #163040 - Flags: review?(kaie)
Comment on attachment 163040 [details] [diff] [review]
changes

>Index: security/manager/ssl/src/nsPKCS12Blob.cpp

>+  {
>+    NS_ConvertUTF16toUTF8 tokenNameCString(tokenName);
>+    slot = PK11_FindSlotByName(tokenNameCString.BeginWriting());
>+  }

BeginWriting should only be called if you intend to actually write
to the string's buffer.  I think in this case, that NS_CONST_CAST
is better:

  slot = PK11_FindSlotByName(
      NS_CONST_CAST(char *, tokenNameCString.BeginReading()));


sr=darin with that change.  i don't know if kaie is reviewing code
still... you might want to find another reviewer.
Attachment #163040 - Flags: superreview?(darin) → superreview+
i won't need that cast and could use BeginReading as soon as the fix for bug
265686 is available.
Status: NEW → ASSIGNED
Depends on: 265686
Attachment #163040 - Flags: review?(kaie) → review?(cbiesinger)
Comment on attachment 163040 [details] [diff] [review]
changes

more context would've been nice...

security/manager/ssl/src/nsPKCS12Blob.cpp
+    slot = PK11_FindSlotByName(tokenNameCString.BeginWriting());

make that .get()
Attachment #163040 - Flags: review?(cbiesinger) → review+
mozilla/security/manager/ssl/src/nsPKCS12Blob.cpp 	1.42
mozilla/security/manager/ssl/src/nsNSSCertificateDB.cpp 	1.15
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: PSM → Core
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: