From 248bf17de8a25c741393b28e75c4e5380947792c Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 24 Oct 2026 05:27:59 +0200 Subject: Use new ranged unsigned int scanner everywhere and squash some bugs along the way --- proxy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'proxy.c') diff --git a/proxy.c b/proxy.c index ec51630..19a084a 100644 --- a/proxy.c +++ b/proxy.c @@ -20,11 +20,11 @@ #include "io.h" #include "iob.h" #include "ip6.h" -#include "scan.h" #include "socket.h" /* Opentracker */ #include "ot_mutex.h" +#include "ot_scan.h" #include "ot_random.h" #include "ot_stats.h" #include "ot_vector.h" @@ -531,8 +531,9 @@ static int64_t ot_try_bind(ot_ip6 ip, uint16_t port) { return sock; } -static int scan_ip6_port(const char *src, ot_ip6 ip, uint16 *port) { +static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) { const char *s = src; + uint64_t value; int off, bracket = 0; while (isspace(*s)) ++s; @@ -553,8 +554,9 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16 *port) { if (*(s++) != ':') return 0; } - if (!(off = scan_ushort(s, port))) + if (!(off = scan_udec(s, &value, 65535))) return 0; + *port = (uint16_t)value; return off + s - src; } -- cgit v1.3