diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 2b254bdcf3..7b3c8991d2 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -1006,4 +1006,8 @@ ifneq (,$(filter auto_init%,$(USEMODULE))) USEMODULE += preprocessor_successor endif +ifneq (,$(filter uri_parser,$(USEMODULE))) + USEMODULE += fmt +endif + include $(RIOTBASE)/sys/test_utils/Makefile.dep diff --git a/sys/uri_parser/Kconfig b/sys/uri_parser/Kconfig index ddd159a975..7e54a0d15f 100644 --- a/sys/uri_parser/Kconfig +++ b/sys/uri_parser/Kconfig @@ -7,4 +7,5 @@ config MODULE_URI_PARSER bool "URI parser" + select MODULE_FMT depends on TEST_KCONFIG diff --git a/sys/uri_parser/uri_parser.c b/sys/uri_parser/uri_parser.c index f28b6e0211..db4fc4a593 100644 --- a/sys/uri_parser/uri_parser.c +++ b/sys/uri_parser/uri_parser.c @@ -21,6 +21,8 @@ #include #include +#include "fmt.h" + #include "uri_parser.h" #define MAX_PORT_STR_LEN (5) @@ -129,15 +131,8 @@ bool _consume_port(uri_parser_result_t *result, const char *ipv6_end, } } - /* Verify that the next character, after the port, is an invalid - * character for the atol function. Preventing it from reading out- - * side of the port section */ - if ((authority_end[0] >= '0') && (authority_end[0] <= '9')) { - return false; - } - /* Verify that the port is smaller or equal to UINT16_MAX. */ - uint32_t port = atol(port_begin); + uint32_t port = scn_u32_dec(port_begin, port_str_len); if (port > UINT16_MAX) { return false; }