Closed Bug 117931 Opened 24 years ago Closed 24 years ago

Function shExpMatch in nsProxyAutoConfig.js: conversion from shell pattern to regexp is incorrect.

Categories

(Core :: Networking, defect, P3)

All
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.8

People

(Reporter: zybi, Assigned: zybi)

Details

(Whiteboard: [ready to land])

From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011221 BuildID: 2001122108 E.g. currently pattern "abc*" will match "xxabcd", but shouldn't. When converting shell pattern to regexp, pattern should be surrounded by "^" and "$". E.g. "abc*" should be converted to "^abc.*$", but is "abc.*". Reproducible: Always Steps to Reproduce: 1.The simplest way is to look into components/nsProxyAutoConfig.js starting from line 276 and recall how regular expressions differ from shell patterns. Here is my patch: --- components/nsProxyAutoConfig.js-orig Fri Sep 28 22:09:02 2001 +++ components/nsProxyAutoConfig.js Thu Jan 3 15:14:28 2002 @@ -277,7 +277,7 @@ " pattern = pattern.replace(/\\./g, '\\\\.');\n" + " pattern = pattern.replace(/\\*/g, '.*');\n" + " pattern = pattern.replace(/\\?/g, '.');\n" + -" var newRe = new RegExp(pattern);\n" + +" var newRe = new RegExp('^'+pattern+'$');\n" + " return newRe.test(url);\n" + "}\n" +
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: patch
darin for review
Assignee: neeti → darin
patch looks correct to me, but cc'ing some other folks who may know better.
Status: NEW → ASSIGNED
This makes a lot of sense. I don't know if if my review is good for PAC code (about the only place in netwerk/ that it might be), but if so r=tingley.
sr=darin, i'll check this in when the tree opens.
-> 0.9.8 (so i don't forget this one)
Priority: -- → P3
Target Milestone: --- → mozilla0.9.8
Whiteboard: [ready to land]
reassigning to reporter.
Assignee: darin → zybi
Status: ASSIGNED → NEW
fixed-on-trunk
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
QA Contact: benc → pacqa
You need to log in before you can comment on or make changes to this bug.