]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "Attempt to keep fr_nbo_to_foo() from tainting the pointer (#5156)"
authorAlan T. DeKok <aland@freeradius.org>
Mon, 28 Aug 2023 21:05:36 +0000 (17:05 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 28 Aug 2023 21:05:36 +0000 (17:05 -0400)
This reverts commit 6bcdb8a7200cab4d185a9e73a823944983c15a8f.

this made no difference to Coverity

src/lib/util/nbo.h

index 90e66b400847fd8b6c2358af7b8ae56b807f27f4..83de015e74b72c9c5476c9fa16c51d62ac822740 100644 (file)
@@ -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)