dgryski.semgrep-go.readeof.read-io-eof

profile photo of dgryskidgryski
Author
unknown
Download Count*
License

Read() can return n bytes and io.EOF

Run Locally

Run in CI

Defintion

rules:
  - id: read-io-eof
    patterns:
      - pattern: |
          $N, $ERR := $R.Read(($SLICE : []byte))
          if $ERR != nil {
              return ...
          }
      - pattern-not: |
          $N, $ERR := rand.Read(($SLICE : []byte))
          if $ERR != nil {
              return ...
          }
    message: Read() can return n bytes and io.EOF
    languages:
      - go
    severity: ERROR
    metadata:
      license: MIT