From e32d4f3db3f1ed3eebe2e11d57512b60a6c02fa6 Mon Sep 17 00:00:00 2001
From: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon, 23 Aug 2021 18:42:09 +0200
Subject: [PATCH] Suppress UBSan warnings in the xoshiro implementation.

Xoshiro relies on the well defined overflow behavior of unsigned
integer, but UBSan complains about it unless we force it to ignore it.
---
 .ci/sanitizers/ignore.txt | 1 +
 src/autoconnect.c         | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.ci/sanitizers/ignore.txt b/.ci/sanitizers/ignore.txt
index 7295aeb1..724f2789 100644
--- a/.ci/sanitizers/ignore.txt
+++ b/.ci/sanitizers/ignore.txt
@@ -1,2 +1,3 @@
 src:ed25519/*
 src:chacha-poly1305/*
+src:xoshiro.c
diff --git a/src/autoconnect.c b/src/autoconnect.c
index 16093633..9f4abece 100644
--- a/src/autoconnect.c
+++ b/src/autoconnect.c
@@ -48,7 +48,8 @@ static void make_new_connection() {
 			continue;
 		}
 
-		if(r--) {
+		if(r) {
+			--r;
 			continue;
 		}
 
-- 
2.39.5