Closed Bug 417637 Opened 18 years ago Closed 17 years ago

tstclnt crashes if -p option is not specified

Categories

(NSS :: Tools, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
3.11.10

People

(Reporter: nelson, Assigned: nelson)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch v1 (for trunk) (obsolete) — Splinter Review
If tstclnt is invoked without the -p option, it is supposed to use port 443. It does that, but then it crashes, because it tries to free a string that wasn't malloc'ed. This patch fixes it.
Attachment #303421 - Flags: superreview?(julien.pierre.boogz)
Attachment #303421 - Flags: review?(alexei.volkov.bugs)
Comment on attachment 303421 [details] [diff] [review] patch v1 (for trunk) This fixes the leak, but I think the following check is incorrect : + if (!host || portno == ((PRUint16)-1)) + Usage(progName); That's because atoi will return 0 in failure cases, not -1. And we know port 0 is invalid for sure. So you you should check for (!host || !portno) instead.
Attachment #303421 - Flags: superreview?(julien.pierre.boogz) → superreview-
Attached patch patch v2Splinter Review
Thanks, Julien. I was thinking of the function strtol, which I typically use instead of atoi and atol because it allows input to be hex or octal as well as decimal.
Attachment #303421 - Attachment is obsolete: true
Attachment #303762 - Flags: review?(julien.pierre.boogz)
Attachment #303421 - Flags: review?(alexei.volkov.bugs)
Attachment #303762 - Flags: review?(julien.pierre.boogz) → review+
Checking in tstclnt.c; new revision: 1.49; previous revision: 1.48
Priority: -- → P3
Comment on attachment 303762 [details] [diff] [review] patch v2 requesting second review for branch.
Attachment #303762 - Flags: review?(alexei.volkov.bugs)
Attachment #303762 - Flags: review?(alexei.volkov.bugs) → review+
tstclnt.c; new revision: 1.42.2.5; previous revision: 1.42.2.4
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: