Last Comment Bug 142658 - certutil crashes if cert->nickname is NULL
: certutil crashes if cert->nickname is NULL
Product: NSS
Classification: Components
Component: Tools (show other bugs)
: 3.4
: All All
: P2 normal (vote)
: 3.4.2
Assigned To: Wan-Teh Chang
: Bishakha Banerjee
Depends on:
  Show dependency treegraph
Reported: 2002-05-06 16:15 PDT by Julien Pierre
Modified: 2002-05-10 15:11 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

patch to display (NULL) (460 bytes, patch)
2002-05-06 16:16 PDT, Julien Pierre
wtc: review+
Details | Diff | Splinter Review

Description Julien Pierre 2002-05-06 16:15:41 PDT
If both cert->nickname and cert->emailAddr are NULL, certutil -L will crash 
passing a NULL to fprintf.
Comment 1 Julien Pierre 2002-05-06 16:16:09 PDT
Created attachment 82559 [details] [diff] [review]
patch to display (NULL)
Comment 2 Julien Pierre 2002-05-06 16:18:07 PDT
Checked in to NSS_3_4_BRANCH and the tip.
Comment 3 Julien Pierre 2002-05-06 16:18:29 PDT
Comment 4 Wan-Teh Chang 2002-05-06 18:01:16 PDT
Are we sure that "(NULL)" is what we want to display
when cert->emailAddr is NULL?  Seems like the empty
string "" would be better.  Or do you want to indicate
that it is a NULL pointer?
Comment 5 Julien Pierre 2002-05-06 18:10:07 PDT
I wanted to indicate that it was a NULL pointer. This is not normal behavior for 
us to have NULL nicknames. It is likely to cause crashes in other applications, 
which is in fact how this problem was found. So I think it is useful for 
certutil to differentiate between an empty "" nickname and a NULL one.
Comment 6 Wan-Teh Chang 2002-05-07 17:31:50 PDT

Are you sure that it is not normal behavior for 
us to have NULL nicknames?  When there is no
nickname, do we use an empty string "" or a
NULL pointer?  Or is it an error to have no
nickname in the first place?
Comment 7 Julien Pierre 2002-05-07 17:58:29 PDT
No, I am not. Should this bug be reopened ? The patch only affects certutil 
The current behavior just makes it consistent with NT which has stdio displaying 
(NULL) when passing NULL pointers to fprintf, but on Solaris (and maybe on other 
platforms) it just crashes.
Comment 8 Wan-Teh Chang 2002-05-10 14:53:06 PDT

If it is not a bug for a cert to have both a NULL
cert->nickname and a NULL cert->emailAddr, it
is better to print nothing than to print "(NULL)".

I don't know to answer to my question.  Could you
ask Bob or Nelson if they know?  Thanks.
Comment 9 Nelson Bolyard (seldom reads bugmail) 2002-05-10 15:06:51 PDT
Every certificate in the DB should have either a "nickname" or an 
email address record (which is also used as a nickname).  IMO, it is
an error for a certificate in the DB to have neither.  This is one of
the things that the cert DB repair program used to fix.
Comment 10 Wan-Teh Chang 2002-05-10 15:11:14 PDT
Comment on attachment 82559 [details] [diff] [review]
patch to display (NULL)

Nelson, thanks for answering my question.

Then I agree with Julien's fix for this crash.

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