Skip to content

Commit 33d9549

Browse files
committed
Increase line buffer size when reading S3 credentials file
1 parent d9e53aa commit 33d9549

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/cache_rest.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -869,16 +869,18 @@ static void _mapcache_cache_s3_headers_add(mapcache_context *ctx, const char* me
869869
if((rv=apr_file_open(&f, s3->credentials_file,
870870
APR_FOPEN_READ|APR_FOPEN_BUFFERED|APR_FOPEN_BINARY,APR_OS_DEFAULT,
871871
ctx->pool)) == APR_SUCCESS) {
872-
char line[2048];
873-
if( (rv = apr_file_gets(line,2048,f))== APR_SUCCESS) {
872+
// Line length buffer increased to handle longer session tokens; see:
873+
// https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html
874+
char line[4096];
875+
if( (rv = apr_file_gets(line,4096,f))== APR_SUCCESS) {
874876
_remove_lineends(line);
875877
aws_access_key_id = apr_pstrdup(ctx->pool,line);
876878
}
877-
if( (rv = apr_file_gets(line,2048,f))== APR_SUCCESS) {
879+
if( (rv = apr_file_gets(line,4096,f))== APR_SUCCESS) {
878880
_remove_lineends(line);
879881
aws_secret_access_key = apr_pstrdup(ctx->pool,line);
880882
}
881-
if( (rv = apr_file_gets(line,2048,f))== APR_SUCCESS) {
883+
if( (rv = apr_file_gets(line,4096,f))== APR_SUCCESS) {
882884
_remove_lineends(line);
883885
aws_security_token = apr_pstrdup(ctx->pool,line);
884886
}

0 commit comments

Comments
 (0)