diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-24 05:27:59 +0200 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-24 05:27:59 +0200 |
| commit | 248bf17de8a25c741393b28e75c4e5380947792c (patch) | |
| tree | cc9e4b8bbe79f015bb9793968b021e10765008a6 /proxy.c | |
| parent | 5fb172a50fc343ef642745b0ecb4b6a44d274b15 (diff) | |
Use new ranged unsigned int scanner everywhere and squash some bugs along the way
Diffstat (limited to 'proxy.c')
| -rw-r--r-- | proxy.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -20,11 +20,11 @@ | |||
| 20 | #include "io.h" | 20 | #include "io.h" |
| 21 | #include "iob.h" | 21 | #include "iob.h" |
| 22 | #include "ip6.h" | 22 | #include "ip6.h" |
| 23 | #include "scan.h" | ||
| 24 | #include "socket.h" | 23 | #include "socket.h" |
| 25 | 24 | ||
| 26 | /* Opentracker */ | 25 | /* Opentracker */ |
| 27 | #include "ot_mutex.h" | 26 | #include "ot_mutex.h" |
| 27 | #include "ot_scan.h" | ||
| 28 | #include "ot_random.h" | 28 | #include "ot_random.h" |
| 29 | #include "ot_stats.h" | 29 | #include "ot_stats.h" |
| 30 | #include "ot_vector.h" | 30 | #include "ot_vector.h" |
| @@ -531,8 +531,9 @@ static int64_t ot_try_bind(ot_ip6 ip, uint16_t port) { | |||
| 531 | return sock; | 531 | return sock; |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | static int scan_ip6_port(const char *src, ot_ip6 ip, uint16 *port) { | 534 | static int scan_ip6_port(const char *src, ot_ip6 ip, uint16_t *port) { |
| 535 | const char *s = src; | 535 | const char *s = src; |
| 536 | uint64_t value; | ||
| 536 | int off, bracket = 0; | 537 | int off, bracket = 0; |
| 537 | while (isspace(*s)) | 538 | while (isspace(*s)) |
| 538 | ++s; | 539 | ++s; |
| @@ -553,8 +554,9 @@ static int scan_ip6_port(const char *src, ot_ip6 ip, uint16 *port) { | |||
| 553 | if (*(s++) != ':') | 554 | if (*(s++) != ':') |
| 554 | return 0; | 555 | return 0; |
| 555 | } | 556 | } |
| 556 | if (!(off = scan_ushort(s, port))) | 557 | if (!(off = scan_udec(s, &value, 65535))) |
| 557 | return 0; | 558 | return 0; |
| 559 | *port = (uint16_t)value; | ||
| 558 | return off + s - src; | 560 | return off + s - src; |
| 559 | } | 561 | } |
| 560 | 562 | ||
