mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
b2a1ff8e54aaefb70a52e9b3d20adb4f228f8ea3
For some reason (probably by imitation of nmap_getservbyport), protocol numbers, which are byte values 0–255, had htons called on them after being read from nmap-protocols. On little-endian platforms, this turned them into integers 0x0100, 0x0200, 0x0300, etc. protocol_table is supposed to be an array of 256 linked lists, linking all the protocol names of the same number. Because of the above htons conversion, all protocols mapped to bucket 0 on lookup instead. Perhaps in an attempt to work around this broken lookup, all protocols were inserted into bucket 0 on init; all other buckets were empty. This worked on little-endian platforms, but on big-endian platforms where htons is a no-op, all protocol numbers but 0 mapped to an empty linked list. Remove all the htons stuff and just look things up by integers. Use the same mapping on initial insertion and on lookup, so that the buckets are acutally populated. This was noticed by hejianet. http://seclists.org/nmap-dev/2012/q3/1005
Here is some documentation for Nmap, but these files are much less comprehensive than what you'll find at the actual Nmap documentation site ( http://nmap.org ).
Description
Languages
C
37.8%
Lua
28.1%
C++
16.7%
Shell
5.8%
Python
4.2%
Other
7.2%