Closed Bug 247406 Opened 20 years ago Closed 20 years ago

secport.h has PORT_Strdup in C++ unsafe section

Categories

(NSS :: Libraries, defect, P2)

3.9.2
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julien.pierre, Assigned: julien.pierre)

Details

Attachments

(1 file, 1 obsolete file)

PORT_Strdup was changed from a macro to a function . But it isn't in the extern
"C" section of the file . This caused some of our admin applications not to link.
I will attach a fix for it.

While reviewing this file, I noticed something about XP_STRINGS_FUNCS and
different definitions, including for PORT_Strdup . Is that section every used,
and if so, by who ? It seems dangerous . Can it be removed ?
Priority: -- → P2
Target Milestone: --- → 3.9.2
Attachment #151062 - Flags: superreview?(wchang0222)
Attachment #151062 - Flags: review?(glen.beasley)
Comment on attachment 151062 [details] [diff] [review]
move PORT_Strdup to extern "C" section

Julien, please also remove the line:

#define PORT_Strdup	XP_STRDUP

or the whole #ifdef XP_STRING_FUNCS block.
This is to prevent the (dead) code from
becoming inconsistent.

Nit: it looks nicer to move PORT_Strdup
under PORT_ZFree.
Attachment #151062 - Flags: superreview?(wchang0222)
Attachment #151062 - Flags: superreview-
Attachment #151062 - Flags: review?(glen.beasley)
Julien, if I remember correctly, the XP_STRING_FUNCS
section is for old Netscape browser code predating
NSPR.  That section is dead code now.  I suggest that
we remove it.  Bob, Nelson, what do you think?
Attachment #151068 - Flags: superreview?(julien.pierre.bugs)
Attachment #151068 - Flags: review?(glen.beasley)
Comment on attachment 151068 [details] [diff] [review]
move PORT_Strdup to extern "C" section; remove XP_STRING_FUNCS section

Looks good.
Attachment #151068 - Flags: superreview?(julien.pierre.bugs) → superreview+
comment #3, 
<begin sarcasm>
I don't know. I think that code is on a 25 year depriciation schedule.:)
<end sarcasm>

I'm pretty sure we aren't going to resurrect XP_ code so I don't have any 
objections to removing the section.

bob
Comment on attachment 151068 [details] [diff] [review]
move PORT_Strdup to extern "C" section; remove XP_STRING_FUNCS section

patch looks good.
Attachment #151068 - Flags: review?(glen.beasley) → review+
Checked in to NSS_3_9_BRANCH :

Checking in secport.h;
/cvsroot/mozilla/security/nss/lib/util/secport.h,v  <--  secport.h
new revision: 1.8.2.1; previous revision: 1.8
done

And tip :

Checking in secport.h;
/cvsroot/mozilla/security/nss/lib/util/secport.h,v  <--  secport.h
new revision: 1.11; previous revision: 1.10
done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
The entire PORT_ set of macros and functions was originally created back
when the Netscape browser source was beginning to migrate to use the modern
NSPR (which was then known as NSPR2).  The PORT macros expanded to either
NSPR 1 symbols (XP_*) or other symbols depending on some #defines.
The XP_ code is now ancient history.  I agree that stuff can all be removed.


You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: