Closed Bug 300420 Opened 19 years ago Closed 19 years ago

Leading zero on proxy port number causes a bogus port number to be configured

Categories

(Firefox :: Settings UI, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 299580

People

(Reporter: alynch, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050608 Firefox/1.0.4 (Ubuntu package 1.0.4)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050608 Firefox/1.0.4 (Ubuntu package 1.0.4)

A port number with a leading zero in the http proxy port prefs field (eg: 03128)
is misinterpreted, and a completely different port number is configured (in this
case 202).  It turns out that the number is parsed in octal. (Hex is also accepted!)
This is easy to do accidently when cutting and pasting - it would be less
confusing if the number were read as a decimal value, since this is most likely
the user's intention.

Reproducible: Always

Steps to Reproduce:
1. Go to Edit/Preferences/Connection settings
2. Enter an http proxy host & port number with leading zero (easy to do with
middle button cut 'n' paste eg: proxy 03128
3. This is no 3.

Actual Results:  
 network.proxy.http_port shows up in prefs, about:config as 202.
 proxy settings don't work due to incorrect value.

Expected Results:  
 network.proxy.http_port should show up in prefs, about:config as entered.
 proxy settings work.
If it starts with a '0', then it's interpreted as an octal number. But 8 is not
valid in octal mode, so it stops there. And 312 (octal) == 202 (dec).

Are we using strtol() here with base 0 (or the JavaScript equivalent) ? That
accepts octal and hexadecimal encoding. You can force it to decmimal encoding by
setting base to 10 - like atoi() does for example. I don't think end-users need
to specify octal or hexadecimal numbers.

*** This bug has been marked as a duplicate of 299580 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
V/dupe.
You need to log in before you can comment on or make changes to this bug.