summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2017-07-27 05:57:04 +0000
committeryasuoka <yasuoka@openbsd.org>2017-07-27 05:57:04 +0000
commit4b04d12716c684b67424f6bbf2a8803b8b75385f (patch)
tree5f64d1fe06b1cde64e95551ff18ca69304678506
parentget rid of flag clang doesn't grok (include -Werror in Configure, because (diff)
downloadwireguard-openbsd-4b04d12716c684b67424f6bbf2a8803b8b75385f.tar.xz
wireguard-openbsd-4b04d12716c684b67424f6bbf2a8803b8b75385f.zip
SEQ16_* macros weren't able to compare properly if one of the sequences is
wrapped around. Fix them to cast the proper width of integer when comparison. found goda@
-rw-r--r--sys/net/pipex_local.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/net/pipex_local.h b/sys/net/pipex_local.h
index 876eda21e57..218a9b71ba3 100644
--- a/sys/net/pipex_local.h
+++ b/sys/net/pipex_local.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pipex_local.h,v 1.28 2017/05/28 21:57:19 mlarkin Exp $ */
+/* $OpenBSD: pipex_local.h,v 1.29 2017/07/27 05:57:04 yasuoka Exp $ */
/*
* Copyright (c) 2009 Internet Initiative Japan Inc.
@@ -336,16 +336,16 @@ extern struct pipex_hash_head pipex_id_hashtable[];
}
#define PIPEX_SEEK_NEXTHDR(ptr, len, t) \
((t) (((char *)ptr) + len))
-#define SEQ32_LT(a,b) ((int)((a) - (b)) < 0)
-#define SEQ32_LE(a,b) ((int)((a) - (b)) <= 0)
-#define SEQ32_GT(a,b) ((int)((a) - (b)) > 0)
-#define SEQ32_GE(a,b) ((int)((a) - (b)) >= 0)
+#define SEQ32_LT(a,b) ((int32_t)((a) - (b)) < 0)
+#define SEQ32_LE(a,b) ((int32_t)((a) - (b)) <= 0)
+#define SEQ32_GT(a,b) ((int32_t)((a) - (b)) > 0)
+#define SEQ32_GE(a,b) ((int32_t)((a) - (b)) >= 0)
#define SEQ32_SUB(a,b) ((int32_t)((a) - (b)))
-#define SEQ16_LT(a,b) ((int)((a) - (b)) < 0)
-#define SEQ16_LE(a,b) ((int)((a) - (b)) <= 0)
-#define SEQ16_GT(a,b) ((int)((a) - (b)) > 0)
-#define SEQ16_GE(a,b) ((int)((a) - (b)) >= 0)
+#define SEQ16_LT(a,b) ((int16_t)((a) - (b)) < 0)
+#define SEQ16_LE(a,b) ((int16_t)((a) - (b)) <= 0)
+#define SEQ16_GT(a,b) ((int16_t)((a) - (b)) > 0)
+#define SEQ16_GE(a,b) ((int16_t)((a) - (b)) >= 0)
#define SEQ16_SUB(a,b) ((int16_t)((a) - (b)))
#define pipex_session_is_acfc_accepted(s) \