Share

wput

Tracker: Bugs

5 Incorrect server IP retreiving from passive string - ID: 2463041
Last Update: Comment added ( rumpeltux )

Data from -ΠΌΠΌ debug output:
----------------------------------
==> PASV ... ---->PASV
Checking whether 3 is writable... 1 (115:Operation now in progress)
[227] 'Entering Passive Mode (192,168,0,100,4,73)'
done.
Remote server data port: 192.168.56.34:1097
----------------------------------

From a phrase a server sent us we can see that the server IP is
192.168.0.100 (as it should be, because my ftp server IP is that one).

But after wput parsed string from the server we can see bytes 3 and 4 (56
and 34 respectively) are wrong.

This behaviour caused by a method we allocate memory for IP data.

We use allocate dynamic array on the stack in function
"parse_passive_string" like that:

char temp[6];

And then we pass a pointer to this array outside the function.

So, either we have to make this array "static" (the easiest way) like
that:

static char temp[6];

or allocate 6 bytes in "ftp_do_passive" function and pass a pointer to this
memory area to the "parse_passive_string" (the best way).


Bolick ( bolick ) - 2008-12-24 00:27

5

Closed

Works For Me

Giovanni Bechis

Core Source

None

Public


Comments ( 2 )

Date: 2008-12-24 10:23
Sender: rumpeltuxProject AdminAccepting Donations

I took a look at the source, there is no pointer passed outside the
function. And the parsing works fine even for this IP, unless you are
running special hardware with weird integer sizes.


Date: 2008-12-24 08:36
Sender: gbechis

I have tried a bit but it works for me:
----------------------------------
==> PASV ... ---->PASV
Checking whether 3 is writable... 1 (36:Operation now in progress)
[227] 'Entering Passive Mode (192,168,107,254,204,159)'
done.
Remote server data port: 192.168.107.254:52383
----------------------------------


Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2008-12-24 08:36 gbechis
resolution_id None 2008-12-24 08:36 gbechis
close_date - 2008-12-24 08:36 gbechis
assigned_to nobody 2008-12-24 00:29 bolick