Skip to content

Commit 22fa4ff

Browse files
committed
all: fix printf(var) mistakes detected by latest printf checker
This includes testdata files that incorrectly formatted "%40l". For golang/go#69267. Change-Id: Ibd22b65c89382b386452f0a5b442bb94a4c03c22 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/610955 Reviewed-by: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 78c6ef6 commit 22fa4ff

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

all_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func TestLintReports(t *testing.T) {
113113
}
114114
lints := lint(r)
115115
if len(lints) > 0 {
116-
t.Errorf(strings.Join(lints, "\n"))
116+
t.Error(strings.Join(lints, "\n"))
117117
}
118118
duplicates := make(map[string][]string)
119119
for _, alias := range r.Aliases() {

internal/cve5/cveclient.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package cve5
77
import (
88
"bytes"
99
"encoding/json"
10+
"errors"
1011
"fmt"
1112
"io"
1213
"net/http"
@@ -496,5 +497,5 @@ func extractError(resp *http.Response) error {
496497
errMsg = fmt.Sprintf("%s\n %s: %s", errMsg, detail.InstancePath, detail.Message)
497498
}
498499

499-
return fmt.Errorf(errMsg)
500+
return errors.New(errMsg)
500501
}

internal/cve5/testdata/cve/TestToReport/CVE-2021-27919.txtar

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ notes:
2424
- lint: 'modules[0] "std": packages[0] "archive/zip": at least one of vulnerable_at and skip_fix must be set'
2525
- lint: 'references: must contain at least one fix'
2626
- lint: 'references: must contain at least one report'
27-
- lint: 'references[0] "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/": "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/": advisory reference must not be set for first-party issues'
28-
- lint: 'references[1] "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/": "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/": advisory reference must not be set for first-party issues'
27+
- lint: 'references[0] "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/2MU47VKTNXX33ZDLTI2ORRUY3KLJKU6G/": advisory reference must not be set for first-party issues'
28+
- lint: 'references[1] "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HM7U5JNS5WU66Q3S26PFIU2ITB2ATTQ4/": advisory reference must not be set for first-party issues'
2929
- lint: 'references[2] "https://nvd.nist.gov/vuln/detail/CVE-2021-27919": "https://nvd.nist.gov/vuln/detail/CVE-2021-27919": advisory reference must not be set for first-party issues'
3030
- lint: 'references[3] "https://security.gentoo.org/glsa/202208-02": "https://security.gentoo.org/glsa/202208-02": advisory reference must not be set for first-party issues'
3131
source:

internal/cve5/testdata/cve/TestToReport/CVE-2021-3115.txtar

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ notes:
2525
- lint: 'modules[0] "cmd": packages[0] "cmd/go": at least one of vulnerable_at and skip_fix must be set'
2626
- lint: 'references: must contain at least one fix'
2727
- lint: 'references: must contain at least one report'
28-
- lint: 'references[0] "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/": "https://lists.fedoraproject.org/archives/list/package-announce%!l(MISSING)ists.fedoraproject.org/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/": advisory reference must not be set for first-party issues'
28+
- lint: 'references[0] "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/YWAYJGXWC232SG3UR3TR574E6BP3OSQQ/": advisory reference must not be set for first-party issues'
2929
- lint: 'references[1] "https://nvd.nist.gov/vuln/detail/CVE-2021-3115": "https://nvd.nist.gov/vuln/detail/CVE-2021-3115": advisory reference must not be set for first-party issues'
3030
- lint: 'references[2] "https://security.gentoo.org/glsa/202208-02": "https://security.gentoo.org/glsa/202208-02": advisory reference must not be set for first-party issues'
3131
- lint: 'references[3] "https://blog.go.dev/path-security": "https://blog.go.dev/path-security": web reference must match regex "https://groups.google.com/g/golang-(announce|dev|nuts)/c/([^/]+)"'

internal/report/lint.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ func (r *Report) LintAsNotes(pc *proxy.Client) bool {
481481
if lints := r.Lint(pc); len(lints) > 0 {
482482
slices.Sort(lints)
483483
for _, lint := range lints {
484-
r.AddNote(NoteTypeLint, lint)
484+
r.AddNote(NoteTypeLint, "%s", lint)
485485
}
486486
return true
487487
}

internal/worker/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (s *Server) serveError(ctx context.Context, w http.ResponseWriter, _ *http.
153153
serr = &serverError{status: http.StatusInternalServerError, err: err}
154154
}
155155
if serr.status == http.StatusInternalServerError {
156-
log.Errorf(ctx, serr.err.Error())
156+
log.Errorf(ctx, "%s", serr.err.Error())
157157
} else {
158158
log.Errorf(ctx, "returning %d (%s) for error %v", serr.status, http.StatusText(serr.status), err)
159159
}

0 commit comments

Comments
 (0)