summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2025-04-11 12:04:28 -0700
committerGravatar Anshul Gupta <ansg191@anshulg.com> 2025-04-11 12:04:28 -0700
commitf5e9b9211d077705ae68ee179a2a2373aa8ed885 (patch)
tree10bb8a289b200d180a4912fc6c272313fdfb2521 /src/config.c
parent31fe9b891bfe816841580a8da9a6fea9d7569413 (diff)
downloadgithub-mirror-f5e9b9211d077705ae68ee179a2a2373aa8ed885.tar.gz
github-mirror-f5e9b9211d077705ae68ee179a2a2373aa8ed885.tar.zst
github-mirror-f5e9b9211d077705ae68ee179a2a2373aa8ed885.zip
Add `github_pat_` to token patterns
Also increase token buffer size from 64 to 1024.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c
index f143f55..f473dd9 100644
--- a/src/config.c
+++ b/src/config.c
@@ -91,6 +91,7 @@ static char *trim(char *start, char *end)
* - "ghu_"
* - "ghs_"
* - "ghf_"
+ * - "github_pat_"
* @param value token value
* @param cfg config struct
* @return 0 on success, -1 on error
@@ -112,7 +113,7 @@ static int parse_token(char *value, struct config *cfg)
}
// Read the file
- token = malloc(64);
+ token = malloc(1024);
if (!token) {
perror("Error allocating token buffer");
close(fd);
@@ -120,7 +121,7 @@ static int parse_token(char *value, struct config *cfg)
}
// Read the file contents
- const ssize_t bytes_read = read(fd, token, 64);
+ const ssize_t bytes_read = read(fd, token, 1024);
if (bytes_read < 0) {
perror("Error reading token file");
free(token);
@@ -135,7 +136,7 @@ static int parse_token(char *value, struct config *cfg)
token_check:
if (!strncmp(token, "ghp_", 4) || !strncmp(token, "gho_", 4) ||
!strncmp(token, "ghu_", 4) || !strncmp(token, "ghs_", 4) ||
- !strncmp(token, "ghf_", 4)) {
+ !strncmp(token, "ghf_", 4) || !strncmp(token, "github_pat_", 11)) {
cfg->token = token;
} else {
fprintf(stderr, "Error: invalid token format: %s\n", token);