Closed
Bug 101651
Opened 23 years ago
Closed 23 years ago
nsStdURL::SetSpec can trash memory
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla0.9.6
People
(Reporter: sfraser_bugs, Assigned: gordon)
Details
Attachments
(2 files)
2.46 KB,
patch
|
andreas.otte
:
review+
|
Details | Diff | Splinter Review |
2.20 KB,
patch
|
sfraser_bugs
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
nsStdURL::SetSpec has some bad logic for stripping CR and LF from url strings. This loop: while (midPtr && (*midPtr != '\0')) { while ((*midPtr == '\r') || (*midPtr == '\n') || (*midPtr == '\t')) { // if linebreak or tab if (!copyToPtr) copyToPtr = midPtr; // start copying midPtr++; // skip linebreak and tab } if (copyToPtr) { // if copying *copyToPtr = *midPtr; copyToPtr++; } midPtr++; } misbehaves when a url string has one or more trailing CRs, like: http://foo.bar.com\r\r, since it fails to detect when midPtr has reached the end of the string (it increments to the character past the \0 before testing).
Reporter | ||
Comment 1•23 years ago
|
||
Reporter | ||
Comment 2•23 years ago
|
||
The patch is a much cleaner version of this code, that (I think) does exactly the same thing.
Comment 3•23 years ago
|
||
The patch looks good to me on first sight, but I can't apply it on linux, seems to be made on the mac. Is there a way to convert the patch or attach a new version with char(10) instead of char(13) as eol indicators?
Reporter | ||
Comment 4•23 years ago
|
||
You'll have to convert the linebreaks on the patch using 'tr', or some small perl script.
Comment 5•23 years ago
|
||
Comment on attachment 50810 [details] [diff] [review] Cleaned up the code that removes bad chars from the url string tr is working fine, and so is the patch.
Attachment #50810 -
Flags: review+
Comment 6•23 years ago
|
||
r=andreas.otte@primus-online.de
Reporter | ||
Comment 7•23 years ago
|
||
darin, sr please?
Comment 8•23 years ago
|
||
Comment on attachment 50810 [details] [diff] [review] Cleaned up the code that removes bad chars from the url string looks like nsStdURL.cpp uses 4 spaces of indentation... fix that, and sr=darin
Attachment #50810 -
Flags: needs-work+
Simon, would you like me to finish this up and get it in?
Assignee: neeti → gordon
Target Milestone: --- → mozilla0.9.6
Reporter | ||
Comment 10•23 years ago
|
||
Yes please.
Assignee | ||
Comment 11•23 years ago
|
||
Reporter | ||
Comment 12•23 years ago
|
||
Comment on attachment 54115 [details] [diff] [review] update of simon's patch for recent file changes, and incorporating white space changes suggested by darin. r=sfraser
Attachment #54115 -
Flags: review+
Comment 13•23 years ago
|
||
Comment on attachment 54115 [details] [diff] [review] update of simon's patch for recent file changes, and incorporating white space changes suggested by darin. sr=darin (nice job cleaning this up)
Attachment #54115 -
Flags: superreview+
Assignee | ||
Comment 14•23 years ago
|
||
revised patch checked in. Marking FIXED.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•