Skip to content

Commit f0d5d5d

Browse files
committed
git_httpd_controller fix to deal with null buf (which is possible).
Grabbed fix from Eric Bishop (who received via email by Davil Vallejo).
1 parent f2c3b7f commit f0d5d5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/controllers/git_http_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ def service_rpc(rpc)
109109
render :text => proc { |response, output|
110110
buf_length=131072
111111
buf = @git_http_control_pipe.read(buf_length)
112-
while(buf.length == buf_length)
112+
while(!(buf.nil?) && buf.length == buf_length)
113113
output.write( buf )
114114
buf = @git_http_control_pipe.read(buf_length)
115115
end
116-
if(buf.length > 0)
116+
if(!(buf.nil?) && buf.length > 0)
117117
output.write( buf )
118118
end
119119
@git_http_control_pipe.close
@@ -192,11 +192,11 @@ def internal_send_file(reqfile, content_type)
192192
render :text => proc { |response, output|
193193
buf_length=131072
194194
buf = @git_http_control_pipe.read(buf_length)
195-
while(buf.length == buf_length)
195+
while(!(buf.nil?) && buf.length == buf_length)
196196
output.write( buf )
197197
buf = @git_http_control_pipe.read(buf_length)
198198
end
199-
if(buf.length > 0)
199+
if(!(buf.nil?) && buf.length > 0)
200200
output.write( buf )
201201
end
202202
@git_http_control_pipe.close

0 commit comments

Comments
 (0)