Closed Bug 817225 Opened 13 years ago Closed 13 years ago

Small decimal ip in DCC protocol are not correctly converted

Categories

(Other Applications Graveyard :: ChatZilla, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nit, Assigned: dsarratt)

Details

(Whiteboard: [cz-0.9.90])

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0 Build ID: 20121025210805 Steps to reproduce: I offer dcc file transfert from a small ip to a chatzilla client Actual results: Chatzilla doesn't correctly convert the decimal ip offer by the DCC SEND command, and so the transfert is impossible. the DCC command receive by the client (using tcpdump) : :test!~test@***** PRIVMSG chatzilla123 :.DCC SEND file.txt 16843009 41039 12 the message of chatzilla : Got DCC File Transfer offer from “test” (16.16.16.1:41039) of “file.txt” (12.0[Accept] [Decline]. or 16843009 is the decimal version of 1.1.1.1 not of 16.16.16.1 Expected results: Chatzilla should correctly convert the ip address
btw, I am running the version 0.9.89 of chatzilla with firefox 16.0.2 on Ubuntu 12.04
Looks like a problem with converting the decimal format to dotted-decimal. The conversion goes through a hex string, but if the string is less than 8 characters the octets aren't broken up properly (so in this case, 16843009 -> x1010101, which gets broken up as 10:10:10:1 rather than the (correct) 1:01:01:01). I've fixed it by padding the hex string with leading 0s, to ensure it's 8 characters.
Attachment #687359 - Flags: review?
Comment on attachment 687359 [details] [diff] [review] Pads the hex IP string to 8 chars Review of attachment 687359 [details] [diff] [review]: ----------------------------------------------------------------- Looks good; I would also have accepted replacing the code with >> and & operators. ::: js/lib/irc.js @@ +2751,4 @@ > e.id = ary[2]; > // Cheeky longword --> dotted IP conversion. > var host = Number(e.id).toString(16); > + while(host.length < 8) Nit: Space after 'while' keyword.
Attachment #687359 - Flags: review? → review+
Assignee: rginda → dsarratt
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Version: unspecified → Trunk
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Attached patch Nicer methodSplinter Review
Noticed the same bug 20 lines up, so fixed that too. Silver also suggested a bit-shifting method for converting to dotted-decimal notation, which avoids excessive number->string->number conversions.
Attachment #687371 - Flags: review?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 687371 [details] [diff] [review] Nicer method Review of attachment 687371 [details] [diff] [review]: ----------------------------------------------------------------- Thanks!
Attachment #687371 - Flags: review? → review+
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Whiteboard: [cz-0.9.90]
Product: Other Applications → Other Applications Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: