Closed Bug 103893 Opened 23 years ago Closed 23 years ago

nickname is not NULL-terminated

Categories

(NSS :: Libraries, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jamie-bugzilla, Assigned: jamie-bugzilla)

Details

Attachments

(1 file)

This code at pkcs11.c:656, in pk11_handleCertObject, doesn't properly
NULL-terminate the copied nickname string.

cert->nickname = (char *)PORT_ArenaAlloc(cert->arena, PORT_Strlen(label)+1);   
       if(cert->nickname == NULL) {
    return CKR_HOST_MEMORY;
}
PORT_Memcpy(cert->nickname, label, PORT_Strlen(label));

This doesn't cause any problems in the code path I witnessed, but it did cause
some confusion during debugging.
That whole thing can be replaced by a PORT_ArenaStrdup call:
    cert->nickname = PORT_ArenaStrdup(cert->arena, label);

Could you take care of that?  Do you think this fix should
also be checked in on the NSS_3_3_BRANCH? 
Assignee: wtc → nicolson
Priority: -- → P2
Target Milestone: --- → 3.4
OK, checked in on the NSS_3_3_BRANCH and the trunk.

/cvsroot/mozilla/security/nss/lib/softoken/pkcs11.c,v  <--  pkcs11.c
new revision: 1.8.2.3; previous revision: 1.8.2.2

/cvsroot/mozilla/security/nss/lib/softoken/pkcs11.c,v  <--  pkcs11.c
new revision: 1.17; previous revision: 1.16
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Attachment #52769 - Flags: review+
Looks good.
r=relyea
Changed target milestone to 3.3.2 because the fix is in
3.3.2.
Target Milestone: 3.4 → 3.3.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: