Closed Bug 245516 Opened 21 years ago Closed 21 years ago

SplitPath in nsLocalFileCommon reads off the end of the string

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bmo, Assigned: bmo)

References

()

Details

Attachments

(1 file, 1 obsolete file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040514 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040514 <http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsLocalFileCommon.cpp#145> SplitPath has a loop where it splits a path string into an array of path components. The control statement of the loop checks the current character for null. Inside the body of the loop however, whenever the current character is found to be a path sep character, it is nulled out and incremented. If not null, processing is done. Since the for loop will increment the pointer before checking it, this will step it off the end of the string in the case that it was null. i.e. if the input string is "c:\" it will step off the end of the string. We need to break the for loop in this case. Patch to be attached. Reproducible: Always Steps to Reproduce:
Attached patch patch 1 (obsolete) — Splinter Review
Where the next character is checked for null, break the loop if it is.
Comment on attachment 149965 [details] [diff] [review] patch 1 simple if() statement change.
Attachment #149965 - Flags: superreview?(dougt)
Attachment #149965 - Flags: review?(darin)
Comment on attachment 149965 [details] [diff] [review] patch 1 lose the else
Attached patch patch 2Splinter Review
Lost the else
Attachment #149965 - Attachment is obsolete: true
Attachment #149965 - Flags: superreview?(dougt)
Attachment #149965 - Flags: review?(darin)
Attachment #149967 - Flags: review?(timeless)
confirming because of patch
Status: UNCONFIRMED → NEW
Ever confirmed: true
patch is written
Assignee: dougt → brofield
Attachment #149967 - Flags: superreview?(dougt)
Attachment #149967 - Flags: review?(timeless) → review+
Attachment #149967 - Flags: superreview?(dougt) → superreview+
Checking in nsLocalFileCommon.cpp; /cvsroot/mozilla/xpcom/io/nsLocalFileCommon.cpp,v <-- nsLocalFileCommon.cpp new revision: 1.46; previous revision: 1.45 done Thank you Brodie.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: