title: G110: Potential DoS vulnerability via decompression bomb (gosec)
body: <p>I'm getting the following <code>golintci</code> message:</p>
  <pre><code>testdrive/utils.go:92:16: G110: Potential DoS vulnerability via decompression bomb (gosec)
      if _, err := io.Copy(targetFile, fileReader); err != nil {
                   ^
  </code></pre>
  <p>Read the corresponding <a href="https://cwe.mitre.org/data/definitions/409.html" rel="noreferrer">CWE</a> and I'm not clear on how this is expected to be corrected.</p>
  <p>Please offer pointers.</p>
  <pre><code>func unzip(archive, target string) error {
      reader, err := zip.OpenReader(archive)
      if err != nil {
          return err
      }
  
      for _, file := range reader.File {
          path := filepath.Join(target, file.Name) // nolint: gosec
          if file.FileInfo().IsDir() {
              if err := os.MkdirAll(path, file.Mode()); err != nil {
                  return err
              }
              continue
          }
  
          fileReader, err := file.Open()
          if err != nil {
              return err
          }
          defer fileReader.Close() // nolint: errcheck
  
          targetFile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, file.Mode())
          if err != nil {
              return err
          }
          defer targetFile.Close() // nolint: errcheck
  
          if _, err := io.Copy(targetFile, fileReader); err != nil {
              return err
          }
      }
  
      return nil
  }
  </code></pre>