Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

From Andrew Pritchard:

use io.ReadFull in fcgi implementation
in some cases, particularly UNIX domain sockets, pipes, or other things
with 4k (page-sized) buffers, FCGI requests longer than that buffer size
are truncated by io.Reader.Read returning fewer bytes than the full
slice size.  Fix this by using io.ReadFull
  • Loading branch information...
commit f16f5d2e15bb7aacfa8779c0a15dbc2214201309 1 parent 61b0bff
@hoisie authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 fcgi.go
View
12 fcgi.go
@@ -245,12 +245,20 @@ func (s *Server) handleFcgiConnection(fd io.ReadWriteCloser) {
break
}
content := make([]byte, h.ContentLength)
- br.Read(content)
+ _, err = io.ReadFull(br, content)
+ if err != nil {
+ s.Logger.Println("FCGI Error", err.String())
+ break
+ }
//read padding
if h.PaddingLength > 0 {
padding := make([]byte, h.PaddingLength)
- br.Read(padding)
+ _, err = io.ReadFull(br, padding)
+ if err != nil {
+ s.Logger.Println("FCGI Error", err.String())
+ break
+ }
}
switch h.Type {
Please sign in to comment.
Something went wrong with that request. Please try again.