prmapopt.c:_PR_MapOptionName is incorrect

RESOLVED FIXED

Status

P3
normal
RESOLVED FIXED
19 years ago
19 years ago

People

(Reporter: wtc, Assigned: wtc)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

19 years ago
The function _PR_MapOptionName in prmapopt.c has a bug.
The code that checks whether the first argument 'optname'
is a valid PRSockOption enumeration constant is wrong.

It is:
    if ((optname < PR_SockOpt_Linger)
    && (optname > PR_SockOpt_MaxSegment))
    {
        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
        return PR_FAILURE;
    }

It should be:
    if ((optname < PR_SockOpt_Linger)
    || (optname >= PR_SockOpt_Last))
    {
        PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
        return PR_FAILURE;
    }

Note && should be || and PR_SockOpt_Last is
used so that the code won't be broken when a new
socket option is added.
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
(Assignee)

Comment 1

19 years ago
The fix is checked in.
/cvsroot/mozilla/nsprpub/pr/src/io/prmapopt.c, revision 3.12
/m/src/ns/nspr20/pr/src/io/prmapopt.c, revision 2.10
You need to log in before you can comment on or make changes to this bug.