From 8953a3b907edc5541ab7c0657763fc16db8f6067 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 Feb 2025 12:25:46 +0200 Subject: Review app id --- mod/mod-ci-github.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 4d68f7b..c62f33e 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -17,6 +17,8 @@ #include #include +#include +#include // strtoull() #include // Resources: @@ -284,9 +286,11 @@ namespace brep // Parse the app id value. // + const char* b (rp.value->c_str ()); char* e (nullptr); - app_id = strtoull (rp.value->c_str (), &e, 10); - if (app_id == 0 || app_id == ULLONG_MAX || *e != '\0') + errno = 0; // We must clear it according to POSIX. + app_id = strtoull (b, &e, 10); + if (errno == ERANGE || e == b || *e != '\0') { badreq ("invalid 'app-id' webhook query parameter value: '" + *rp.value + '\''); -- cgit v1.1