Closed Bug 1223316 Opened 9 years ago Closed 9 years ago

[CID 1242519] Position of arguments to nssCKFWSession_SetPIN don't match

Categories

(NSS :: Libraries, defect)

defect
Not set
normal

Tracking

(firefox45 affected)

RESOLVED FIXED
Tracking Status
firefox45 --- affected

People

(Reporter: franziskus, Assigned: franziskus)

References

(Blocks 1 open bug)

Details

(Keywords: coverity)

Attachments

(1 file)

In wrap.c we call 
> nssCKFWSession_SetPIN(fwSession, oldArg, newArg); 
in NSSCKFWC_SetPIN. But nssCKFWSession_SetPIN is defined as
> nssCKFWSession_SetPIN(NSSCKFWSession *fwSession, NSSItem *newPin, NSSItem *oldPin)

This looks wrong to Coverity (and me).
It looks like they're reversed again when calling the SetPIN method; the type is:

  CK_RV (PR_CALLBACK *SetPIN)(
    // (first 6 args removed for clarity)
    NSSItem *oldPin,
    NSSItem *newPin
  );

But the call in nssCKFWSession_SetPIN is:

  error = fwSession->mdSession->SetPIN(/* ... */, newPin, oldPin);
right, so it works, but the variable names make no sense :) I think we should rename the arguments in nssCKFWSession_SetPIN then to (NSSCKFWSession *fwSession, NSSItem *oldPin, NSSItem *newPin).
This is not actually a bug, but we should use proper variable names here to not confuse people (and coverity).
Assignee: nobody → franziskuskiefer
Attachment #8685855 - Flags: review?(martin.thomson)
Comment on attachment 8685855 [details] [diff] [review]
renaming arguments

Review of attachment 8685855 [details] [diff] [review]:
-----------------------------------------------------------------

I checked the functions either side of this and the old/new arguments are the other way around.  This seems to be correct.
Attachment #8685855 - Flags: review?(martin.thomson) → review+
https://hg.mozilla.org/projects/nss/rev/4c2e358644e1
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: