aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2025-02-12 12:25:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2025-02-12 12:25:46 +0200
commit8953a3b907edc5541ab7c0657763fc16db8f6067 (patch)
tree704535f2e0490a0006fd9fa7862b093c6bef01c7 /mod
parent059440a560a21f603847e8e39063afee2f3deb61 (diff)
Review app id
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github.cxx8
1 files changed, 6 insertions, 2 deletions
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 <mod/mod-ci-github-post.hxx>
#include <mod/mod-ci-github-service-data.hxx>
+#include <cerrno>
+#include <cstdlib> // strtoull()
#include <stdexcept>
// 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 + '\'');