Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This program prints out the number received from the socket using an incorrect byte ordering. For example, if the value 4 is sent from a big endian machine, and the receiving system is little endian, the value 536,870,912 is read. This problem can be corrected by sending and receiving using network byte ordering.

Compliant

...

Solution

In this compliant code examplesolution, the programmer uses the ntohl() function to convert the integer from network byte order to host byte ordering:

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

POS39-C

mediumMedium

likelyLikely

lowLow

P18

L1

 

Bibliography

...