crlutil does not truncate output files upon creation

UNCONFIRMED
Unassigned

Status

NSS
Tools
UNCONFIRMED
7 years ago
7 years ago

People

(Reporter: Andrew McKeon, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 564081 [details]
Add PR_TRUNCATE to output file create calls

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Build ID: 20110928134238

Steps to reproduce:

Attempted to create a CRL using the crlutil tool specifying an output file that already exists and is LARGER.

ie. Running these two commands will show the problem. The first command creates a CRL of size 484 bytes, the second should create a CRL of size 467 bytes, but does not.

ie. crlutil -d. -G -n "Oracle Comms Root CA" -f $HOME/.nss/password -o ca.crl << EOF
update=20110901000000Z
nextupdate=20110915235959Z
addcert 4 20110805135000Z
EOF

crlutil -d. -G -n "Oracle Comms Root CA" -f $HOME/.nss/password -o ca.crl << EOF
update=20110916000000Z
addcert 4 20110805135000Z
EOF




Actual results:

Generation of the CRL (and output file) occurred BUT since the original file size was larger than the newer CRL, and  trucation of the file did not occur during opening, excess data was left at the end fo the file. As a result, the output file CRL was unusable, and attempting to use it in NSS would result in SEC_ERROR_EXTRA_INPUT
errors.


Expected results:

Upon writing the output file, the file should be truncated first.
(Reporter)

Comment 1

7 years ago
Please note that I have NOT tested or attempted compilation with the attached
patch diffs.
You need to log in before you can comment on or make changes to this bug.