1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 20:24:26 +01:00

Fix invalid DNS IPv4 address parsing on big endian arch.

This commit is contained in:
Matias Fontanini
2015-04-02 22:43:35 -07:00
parent 5edd5932ba
commit bb683c9f79

View File

@@ -38,6 +38,7 @@
#include "ipv6_address.h"
#include "exceptions.h"
#include "rawpdu.h"
#include "endianness.h"
using std::string;
using std::list;
@@ -373,10 +374,17 @@ void DNS::inline_convert_v4(uint32_t value, char *output) {
output += sprintf(
output,
"%d.%d.%d.%d",
#if TINS_IS_LITTLE_ENDIAN
value & 0xff,
(value >> 8) & 0xff,
(value >> 16) & 0xff,
(value >> 24) & 0xff
#else
(value >> 24) & 0xff,
(value >> 16) & 0xff,
(value >> 8) & 0xff,
value & 0xff
#endif // TINS_IS_LITTLE_ENDIAN
);
*output = 0;
}