From: Alan T. DeKok Date: Mon, 28 Aug 2023 21:05:36 +0000 (-0400) Subject: Revert "Attempt to keep fr_nbo_to_foo() from tainting the pointer (#5156)" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=038234c8632644fe1cc4f4e16d19a9617a6cd81d;p=thirdparty%2Ffreeradius-server.git Revert "Attempt to keep fr_nbo_to_foo() from tainting the pointer (#5156)" This reverts commit 6bcdb8a7200cab4d185a9e73a823944983c15a8f. this made no difference to Coverity --- diff --git a/src/lib/util/nbo.h b/src/lib/util/nbo.h index 90e66b40084..83de015e74b 100644 --- a/src/lib/util/nbo.h +++ b/src/lib/util/nbo.h @@ -128,14 +128,6 @@ static inline size_t fr_nbo_from_uint64v(uint8_t out[static sizeof(uint64_t)], u return ret; } - -/* - * The seemingly needless d pointer in fr_nbo_to_uint{16,32}() - * tries to keep coverity from considering data tainted, which in - * turn makes it think anything accessed via that pointer in the - * caller tainted as well. - */ - /** Read an unsigned 16bit integer from wire format (big endian) * * @param[in] data To convert to a 16bit unsigned integer of native endianness. @@ -143,8 +135,7 @@ static inline size_t fr_nbo_from_uint64v(uint8_t out[static sizeof(uint64_t)], u */ static inline uint16_t fr_nbo_to_uint16(uint8_t const data[static sizeof(uint16_t)]) { - uint8_t const *d = data; - return (((uint16_t)d[0]) << 8) | d[1]; + return (((uint16_t)data[0]) << 8) | data[1]; } /** Read an unsigned 24bit integer from wire format (big endian) @@ -154,8 +145,7 @@ static inline uint16_t fr_nbo_to_uint16(uint8_t const data[static sizeof(uint16_ */ static inline uint32_t fr_nbo_to_uint24(uint8_t const data[static 3]) { - uint8_t const *d = data; - return (((uint32_t)d[0]) << 16) | (((uint32_t)d[1]) << 8) | d[2]; + return (((uint32_t)data[0]) << 16) | (((uint32_t)data[1]) << 8) | data[2]; } /** Read an unsigned 32bit integer from wire format (big endian)