Closed Bug 18520 Opened 26 years ago Closed 26 years ago

prmapopt.c:_PR_MapOptionName is incorrect

Categories

(NSPR :: NSPR, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

Details

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.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
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.