From 24bb9e251969d5cf0e6eee14aad7a7e3bcc59dd8 Mon Sep 17 00:00:00 2001 From: tonypelle Date: Wed, 4 Aug 2021 12:22:44 -0700 Subject: [PATCH] Increase buffer size for oauth access token to 2048 --- src/utils/oauth/oauth.c | 1 - src/utils/oauth/oauth.h | 4 ++++ src/write_stackdriver.c | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils/oauth/oauth.c b/src/utils/oauth/oauth.c index a7ae75d020..9d95720581 100644 --- a/src/utils/oauth/oauth.c +++ b/src/utils/oauth/oauth.c @@ -46,7 +46,6 @@ * monitoring api supports up to 100K bytes in one request, 64K is reasonable */ #define MAX_BUFFER_SIZE 65536 -#define MAX_ENCODE_SIZE 2048 struct oauth_s { char *url; diff --git a/src/utils/oauth/oauth.h b/src/utils/oauth/oauth.h index b93c87b854..be39736c68 100644 --- a/src/utils/oauth/oauth.h +++ b/src/utils/oauth/oauth.h @@ -30,6 +30,10 @@ #define GOOGLE_OAUTH_URL "https://www.googleapis.com/oauth2/v3/token" #endif +#ifndef GOOGLE_OAUTH_ACCESS_TOKEN_SIZE +#define GOOGLE_OAUTH_ACCESS_TOKEN_SIZE 2048 +#endif + struct oauth_s; typedef struct oauth_s oauth_t; diff --git a/src/write_stackdriver.c b/src/write_stackdriver.c index dfa1d7c078..9e5bedc165 100644 --- a/src/write_stackdriver.c +++ b/src/write_stackdriver.c @@ -96,8 +96,8 @@ static size_t wg_write_memory_cb(void *contents, size_t size, static char *wg_get_authorization_header(wg_callback_t *cb) { /* {{{ */ int status = 0; - char access_token[256]; - char authorization_header[256]; + char access_token[GOOGLE_OAUTH_ACCESS_TOKEN_SIZE]; + char authorization_header[GOOGLE_OAUTH_ACCESS_TOKEN_SIZE+32]; assert((cb->auth != NULL) || gce_check()); if (cb->auth != NULL)