Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 454961 - Fix the implementation and use of pr_fgets in signtool
: Fix the implementation and use of pr_fgets in signtool
Product: NSS
Classification: Components
Component: Tools (show other bugs)
: unspecified
: All All
: -- minor (vote)
: 3.12.2
Assigned To: Wan-Teh Chang
Depends on:
  Show dependency treegraph
Reported: 2008-09-11 22:56 PDT by Wan-Teh Chang
Modified: 2008-09-17 17:30 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

Proposed patch (1.47 KB, patch)
2008-09-11 22:56 PDT, Wan-Teh Chang
alvolkov.bgs: review+
Details | Diff | Splinter Review

Description Wan-Teh Chang 2008-09-11 22:56:11 PDT
Created attachment 338264 [details] [diff] [review]
Proposed patch

signtool has a pr_fgets function, which is the fgets function
implemented using NSPR.  Here is the fgets man page:

The implementation of pr_fgets doesn't match fgets exactly in
that pr_fgets doesn't return NULL when 'file' is at end-of-file.
Also, the way we use pr_fgets in signtool.c isn't quite right.
First, there is an accidental use of the comma operator:

    while (pr_fgets(buf, CMD_FILE_BUFSIZE, fd), buf && *buf != '\0') {

Second, we don't need to test *buf != '\0'.  (See the example
code in the fgets man page.)  I believe the *buf != '\0' test
was added to compensate for the incorrect implementation of pr_fgets.
Comment 1 Alexei Volkov 2008-09-16 08:56:13 PDT
Comment on attachment 338264 [details] [diff] [review]
Proposed patch

Patch is correct.
Comment 2 Wan-Teh Chang 2008-09-17 17:30:41 PDT
I checked in the patch on the NSS trunk (NSS 3.12.2).

Checking in signtool.c;
/cvsroot/mozilla/security/nss/cmd/signtool/signtool.c,v  <--  signtool.c
new revision: 1.15; previous revision: 1.14
Checking in util.c;
/cvsroot/mozilla/security/nss/cmd/signtool/util.c,v  <--  util.c
new revision: 1.28; previous revision: 1.27

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