summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-09-15 08:05:06 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-09-15 08:05:06 +0200
commitb97122c3f2450d35f4aab0ecb9b9aa5941bf9bec (patch)
tree6de446243b0b8f9dec7266fca888d5b837fd2aad
parent42bc56209392ed0414ee70b31620f49e45ac9557 (diff)
downloadfastd-b97122c3f2450d35f4aab0ecb9b9aa5941bf9bec.tar
fastd-b97122c3f2450d35f4aab0ecb9b9aa5941bf9bec.zip
handshake: fix fastd_handshake_add_uint logic
The function would add multipe records for big values. No actual use of this function did trigger the incorrect behaviour though.
-rw-r--r--src/handshake.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handshake.h b/src/handshake.h
index ece8f1b..2282b00 100644
--- a/src/handshake.h
+++ b/src/handshake.h
@@ -215,9 +215,9 @@ static inline void fastd_handshake_add_uint16_endian(fastd_handshake_buffer_t *b
static inline void fastd_handshake_add_uint(fastd_handshake_buffer_t *buffer, fastd_handshake_record_type_t type, uint32_t value) {
if (value > 0xffffff)
fastd_handshake_add_uint32(buffer, type, value);
- if (value > 0xffff)
+ else if (value > 0xffff)
fastd_handshake_add_uint24(buffer, type, value);
- if (value > 0xff)
+ else if (value > 0xff)
fastd_handshake_add_uint16(buffer, type, value);
else
fastd_handshake_add_uint8(buffer, type, value);