Skip to content

Commit

Permalink
Merge branch 'main' into james/auto-config-atcs-in-interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett authored Apr 23, 2024
2 parents cbf8db7 + 34e8847 commit bcec485
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ee/agent/storage/sqlite/keyvalue_store_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"embed"
"errors"
"fmt"
"math"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -254,6 +255,13 @@ VALUES %s
ON CONFLICT (name) DO UPDATE SET value=excluded.value;`
valueStr := strings.TrimRight(strings.Repeat("(?, ?),", len(kvPairs)), ",")

// make sure we don't go over max int size
// this is driven codeql code scanning
// https://codeql.github.com/codeql-query-help/go/go-allocation-size-overflow/
if len(kvPairs) > math.MaxInt/2 {
return nil, errors.New("too many key-value pairs")
}

// Build value args; save key names at the same time to determine which keys to prune later
valueArgs := make([]any, 2*len(kvPairs))
keyNames := make([]any, len(kvPairs))
Expand Down

0 comments on commit bcec485

Please sign in to comment.