Closed
Bug 278381
Opened 20 years ago
Closed 20 years ago
double frees found+fixed in pk11pars.h/pk11_mkCipherFlags()
Categories
(NSS :: Libraries, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
3.9.6
People
(Reporter: tim.ruehsen, Assigned: rrelyea)
Details
Attachments
(1 file, 1 obsolete file)
|
1.45 KB,
patch
|
rrelyea
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux) (KHTML, like Gecko) Build Identifier: There are two (possible) double frees in pk11_mkCipherFlags() and one incomplete printf format specifier. The complete code looks like it needs to be rewritten, especially to be NSPR conforming (e.g. there are "%08x" PR_smprintf specifiers with 'long' arguments - looks like this might break where if have 64bit long integers) Anyway, this code is pretty old - is it still used anywhere? Is it worth working on? Reproducible: Always
| Reporter | ||
Comment 1•20 years ago
|
||
should fix the found issues
Comment 2•20 years ago
|
||
Tim: good catch and your fix is correct. How did you discover this bug? Bob: please evaluate the severity of these double frees. Also, I don't understand the 0h0x%08x and 0l0x%08x format strings. What do the "0h" and "0l" mean?
Assignee: wtchang → rrelyea
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•20 years ago
|
||
This is Tim's patch plus my attempt to fix the mismatch between the %08x format specifiers and the unsigned long arguments. I made them %08lx and PRUint32. (In NSPR, the "l" modifier for "%x" means "32-bit", rather than "long".) The correctness of this fix requires that on platforms where long is 64-bit, only the lower 32 bits of slotID (unsigned long) are significant.
Attachment #171259 -
Attachment is obsolete: true
Attachment #171274 -
Flags: review?(rrelyea)
| Assignee | ||
Comment 4•20 years ago
|
||
I'm surprised it hasn't caused a problem up to now. I would expect the softoken to trip over this. (It should be patched as soon as possible). I think the Oh and 0l stand for High and Low. The Database stores a 64 bit mask as 2 32bit values. Note: even if the long is 64 bits, the value of the long can only be up to 32 bits. Good catch, BTW.
| Assignee | ||
Updated•20 years ago
|
Attachment #171274 -
Flags: review?(rrelyea) → review+
Comment 5•20 years ago
|
||
I've checked in this patch on the NSS trunk (3.10). Nelson, Julien, do you want this fix on the NSS 3.9 branch for the NSS 3.9.5 patch release? Bob, the original code not only has double frees but also fails to update 'cipher'. Do you know why things still work with the wrong value of 'cipher'?
Target Milestone: --- → 3.10
Comment 6•20 years ago
|
||
when is this code used? What commonly used NSS functions call it?
| Assignee | ||
Comment 7•20 years ago
|
||
I believe it's used when reading configuration information out of the secmod.db. I would expect it to trip on the softoken, and not on other PKCS #11 modules. I may trip on other hardware accellerators.
| Reporter | ||
Comment 8•20 years ago
|
||
Wan-Teh (#2): remember my request to use gcc's ability to check printf-like formats? I built it into prprf.h for testing, and grepped all warnings coming out. The one in pk11pars.h has been the worst. There are others line using "%d" and having a 'long integer' as param. I make a list and file a bug next week. There should be pendants within the javascript code to PR_s*printf(). I will check the formats here as well. There are many other printf like functions, but maybe not as intensivly used as PR_s*printf and JS_s*printf.
Comment 9•20 years ago
|
||
(In reply to comment #5) > Nelson, Julien, do you want this fix on the NSS 3.9 branch (...) ? Yes, please. Although there are no specific plans for another 3.9.x release at the moment, the liklihood of such another release in (say) the next 6 months seems high. So, if you're willing, please do carry this fix back to the 3.9 branch. Thanks!
Comment 10•20 years ago
|
||
I carried this fix back to the 3.9 branch (NSS 3.9.6).
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: [3.9.6]
Comment 11•20 years ago
|
||
Many thanks, Wan-Teh.
Comment 12•20 years ago
|
||
Setting priorities on unprioritized bugs resolved fixed for NSS 3.10. Marking P1 since it fixes double free.
Priority: -- → P1
Version: unspecified → 3.9
Comment 13•20 years ago
|
||
Changed target milestone to 3.9.6 because we will make a NSS 3.9.6 release before NSS 3.10.
Whiteboard: [3.9.6]
Target Milestone: 3.10 → 3.9.6
You need to log in
before you can comment on or make changes to this bug.
Description
•