diff --git a/client/src/flash.c b/client/src/flash.c index cca2de7b1..4629dbdcd 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -240,7 +240,8 @@ static int print_and_validate_version(struct version_information_t *vi) { return PM3_EFILE; } - char temp[PM3_CMD_DATA_SIZE - 12]; // same limit as for ARM image + // same limit as for ARM image + char temp[PM3_CMD_DATA_SIZE - 12] = {0}; FormatVersionInformation(temp, sizeof(temp), "", vi); PrintAndLogEx(SUCCESS, _CYAN_("ELF file version") _YELLOW_(" %s"), temp); diff --git a/client/src/proxendian.h b/client/src/proxendian.h index 17003e75e..05b699747 100644 --- a/client/src/proxendian.h +++ b/client/src/proxendian.h @@ -53,11 +53,15 @@ #else static inline uint16_t le16(uint16_t v) { - return (v >> 8) | (v << 8); + return (uint16_t)( + (v >> 8) | (v << 8) + ); } static inline uint32_t le32(uint32_t v) { - return (le16(v) << 16) | (le16(v >> 16)); + return (uint32_t)( + (le16(v) << 16) | (le16(v >> 16)) + ); } #endif // HOST_LITTLE_ENDIAN diff --git a/common/commonutil.c b/common/commonutil.c index 5bb77a936..6790d835a 100644 --- a/common/commonutil.c +++ b/common/commonutil.c @@ -160,37 +160,37 @@ uint64_t bytes_to_num(uint8_t *src, size_t len) { return num; } -uint16_t MemLeToUint2byte(const uint8_t *data) { +inline uint16_t MemLeToUint2byte(const uint8_t *data) { return (uint16_t)( (data[1] << 8) + data[0] ); } -uint32_t MemLeToUint3byte(const uint8_t *data) { +inline uint32_t MemLeToUint3byte(const uint8_t *data) { return (uint32_t)( (data[2] << 16) + (data[1] << 8) + data[0] ); } -uint32_t MemLeToUint4byte(const uint8_t *data) { +inline uint32_t MemLeToUint4byte(const uint8_t *data) { return (uint32_t)( (data[3] << 24) + (data[2] << 16) + (data[1] << 8) + data[0] ); } -uint16_t MemBeToUint2byte(const uint8_t *data) { +inline uint16_t MemBeToUint2byte(const uint8_t *data) { return (uint16_t)( (data[0] << 8) + data[1] ); } -uint32_t MemBeToUint3byte(const uint8_t *data) { +inline uint32_t MemBeToUint3byte(const uint8_t *data) { return (uint32_t)( (data[0] << 16) + (data[1] << 8) + data[2] ); } -uint32_t MemBeToUint4byte(const uint8_t *data) { +inline uint32_t MemBeToUint4byte(const uint8_t *data) { return (uint32_t)( (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3] );