diff --git a/hack/docker/gen/main.go b/hack/docker/gen/main.go index 02cdec0815c..10302c71a90 100644 --- a/hack/docker/gen/main.go +++ b/hack/docker/gen/main.go @@ -1023,10 +1023,10 @@ jobs: // remove the double quotation marks from the generated key "on": (note that the word "on" is a reserved word in sigs.k8s.io/yaml) workflowYaml := strings.Replace(string(workflowYamlTmp), "\"on\":", "on:", 1) - totalLen := len(header) + len(workflowYaml) - if totalLen < len(header) || totalLen < len(workflowYaml) { + if len(header) > (int(^uint(0) >> 1) - len(workflowYaml)) { return fmt.Errorf("size computation for allocation may overflow") } + totalLen := len(header) + len(workflowYaml) buf := bytes.NewBuffer(make([]byte, 0, totalLen)) err = license.Execute(buf, data)