Closed
Bug 228618
Opened 22 years ago
Closed 22 years ago
nssPKIObject_RemoveInstanceForToken uses realloc incorrectly.
Categories
(NSS :: Libraries, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
3.9
People
(Reporter: wtc, Assigned: wtc)
References
Details
Attachments
(1 file)
|
1.23 KB,
patch
|
julien.pierre
:
review+
nelson
:
superreview+
|
Details | Diff | Splinter Review |
nssPKIObject_RemoveInstanceForToken uses realloc incorrectly.
object->instances = nss_ZREALLOCARRAY(object->instances,
nssCryptokiObject *,
object->numInstances);
if (!object->instances) {
PZ_Unlock(object->lock);
return PR_FAILURE;
}
There are two problems.
1. It would lose the pointer to the previously allocated memory
block if realloc returns NULL.
2. We are using realloc to shrink the array here. Failure to
shrink the array should be ignored.
| Assignee | ||
Comment 1•22 years ago
|
||
This patches fixes the two problems described above.
It also fixes an unused variable compiler warning.
| Assignee | ||
Updated•22 years ago
|
Attachment #137500 -
Flags: superreview?(MisterSSL)
Attachment #137500 -
Flags: review?(jpierre)
Updated•22 years ago
|
Attachment #137500 -
Flags: review?(jpierre) → review+
| Assignee | ||
Comment 2•22 years ago
|
||
Fix checked in.
Checking in pkibase.c;
/cvsroot/mozilla/security/nss/lib/pki/pkibase.c,v <-- pkibase.c
new revision: 1.22; previous revision: 1.21
done
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.9
Updated•22 years ago
|
Attachment #137500 -
Flags: superreview?(MisterSSL) → superreview+
Comment 3•22 years ago
|
||
*** Bug 221128 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•