sunzhenguo / pacparser

Automatically exported from code.google.com/p/pacparser
GNU Lesser General Public License v3.0
0 stars 0 forks source link

resolve_host in pacparser.c returns garbled IP address list #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

A proxy.pac with following content:
function FindProxyForURL(url, host) { return myIpAddress(); }

manugarg@minesofmoria:~/code/manugarg-pacparser-dev/tests$ pactester -p 
proxy.pac -u http://www.google.com
(,�@�;127.0.0.1
manugarg@minesofmoria:~/code/manugarg-pacparser-dev/tests$ pactester -v
1.2.6-1

What is the expected output?
127.0.0.1

resolve_host function in pacparser.c doesn't behave properly. I could verify 
that by using that function in another test C program. It returns garbage 
characters in ip address list.

Original issue reported on code.google.com by manugarg on 7 Dec 2010 at 5:06

GoogleCodeExporter commented 9 years ago
I think I know what's going on here. I am not initializing ipaddr_list to a 
null string before sprinting strings into it.

http://code.google.com/p/pacparser/source/browse/src/pacparser.c?spec=svneff6bcf
36aa41bdafe60cdde2df3e0b4a7a8c1b7&r=eff6bcf36aa41bdafe60cdde2df3e0b4a7a8c1b7#118

Original comment by manugarg on 7 Dec 2010 at 5:10

GoogleCodeExporter commented 9 years ago
This change should fix it: 
http://code.google.com/r/manugarg-pacparser-dev/source/detail?r=e3b8557c55ed6e82
9249a63d52cd9dd95e77c2cd

Original comment by manugarg on 7 Dec 2010 at 5:15

GoogleCodeExporter commented 9 years ago
I have just cut a new release (1.2.7) which includes this patch.

manugarg@minesofmoria:~/creation/code/pacparser/tools/packages/pacparser-1.2.7/s
rc$ LD_LIBRARY_PATH=. ./pactester -p proxy.pac  -u http://www.google.com
127.0.0.1

Original comment by manugarg on 13 Dec 2010 at 7:37