From ab5157e8464de17206ba2eb8b01e69e48ab37801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serhat=20=C5=9Eevki=20Din=C3=A7er?= Date: Wed, 22 Sep 2021 18:49:37 +0300 Subject: [PATCH 1/2] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..4cbfc30 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,26 @@ +name: "CodeQL" + +on: + push: + branches: [ master ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: 'go' + + - name: CodeQL Analysis + uses: github/codeql-action/analyze@v1 From be73400a2b4d519a74b717050ecc6c9c01bbe488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serhat=20=C5=9Eevki=20Din=C3=A7er?= Date: Wed, 22 Sep 2021 18:59:58 +0300 Subject: [PATCH 2/2] replace Atoi with ParseUint Incorrect conversion between integer types, discovered by CodeQL --- store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store.go b/store.go index 89443c6..f50873c 100644 --- a/store.go +++ b/store.go @@ -49,7 +49,7 @@ type Store interface { // where X is 'i' or 'o' func mIDFromKey(key string) uint16 { s := key[2:] - i, err := strconv.Atoi(s) + i, err := strconv.ParseUint(s, 10, 16) chkerr(err) return uint16(i) }