Closed Bug 269254 Opened 20 years ago Closed 18 years ago

Bug in utf16ToUcs4()

Categories

(Core :: Networking, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: MatsPalmgren_bugz, Assigned: sciguyryan)

References

()

Details

Attachments

(1 file, 1 obsolete file)

Followup from bug 250900 comment 16:

When utf16ToUcs4() in netwerk/dns/src/nsIDNService.cpp
truncates the result it returns a 'outLen' that is 1 too much.

The suggested patch in bug 250900 comment 16 still works (attachment 153220 [details] [diff] [review]).
Assignee: darin → nobody
QA Contact: benc → networking
Attached patch Patch v1 (obsolete) — Splinter Review
Patch v1.

* The null terminating character is set at |out[outBufLen-1]| so the length of the string will be one greater, set |outLen| too |outBufLen|.
Assignee: nobody → sciguyryan+bugzilla
Status: NEW → ASSIGNED
Attachment #244690 - Flags: superreview?
Attachment #244690 - Flags: review?
Attachment #244690 - Flags: superreview?(cbiesinger)
Attachment #244690 - Flags: superreview?
Attachment #244690 - Flags: review?(cbiesinger)
Attachment #244690 - Flags: review?
Attachment #244690 - Flags: superreview?(cbiesinger)
Attachment #244690 - Flags: superreview+
Attachment #244690 - Flags: review?(cbiesinger)
Attachment #244690 - Flags: review+
Whiteboard: [checkin needed]
mozilla/netwerk/dns/src/nsIDNService.cpp 	1.30
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Target Milestone: --- → mozilla1.9alpha
This patch doesn't seem right. With |*outLen = outBufLen;| you include the null terminator in the string's length. The non-error path of the function doesn't. The simple fix is to make it |*outLen = outBufLen - 1;|, or do what the patch Mats referred to did and set i to outBufLen - 1 and break to fall through to the non-error code path to set the null terminator and *outLen.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I was just going to make the same comment that jag made -- looks like this should be outBufLen-1.
Attached patch Patch v2Splinter Review
Patch v2

* Updated too comments (corrected). Thanks for the comments everyone!
Attachment #244690 - Attachment is obsolete: true
Attachment #248922 - Flags: superreview?(cbiesinger)
Attachment #248922 - Flags: review?(cbiesinger)
Comment on attachment 248922 [details] [diff] [review]
Patch v2

sorry for not noticing that :/
Attachment #248922 - Flags: superreview?(cbiesinger)
Attachment #248922 - Flags: superreview+
Attachment #248922 - Flags: review?(cbiesinger)
Attachment #248922 - Flags: review+
(In reply to comment #6)
> (From update of attachment 248922 [details] [diff] [review] [edit])
> sorry for not noticing that :/
> 

My fault really, I should have noticed that too - sorry for the waste of time!
Whiteboard: [checkin needed]
Followup checked in.
mozilla/netwerk/dns/src/nsIDNService.cpp 	1.32
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: