conupefox / tb-tun

Automatically exported from code.google.com/p/tb-tun
0 stars 0 forks source link

tb_userspace.c is not byte-order agnostic #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was skimming through tb_userspace.c and noticed a lot of numeric constants 
with a hard-coded little-endian byte order.

For example, 0x0220 is used to match "2002", which will certainly fail on any 
big-endian architecture.  Instead, you should match against htons(0x2002).

This bug exists all throughout the code.

For a reference on network programming, see:
http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html

Original issue reported on code.google.com by sparkm...@gmail.com on 10 Dec 2010 at 3:30