about summary refs log tree commit homepage
path: root/extras
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-05 23:27:55 +0000
committerEric Wong <e@80x24.org>2016-06-05 23:30:20 +0000
commit9f00d864e25e35ae6cb223b66a434965b14dbdca (patch)
treeb9ebae1d6b61f64be372fb486a37f16677c2663e /extras
parent748a19f0d1bf3e10a79beb1ff5a2a8ddf5134a50 (diff)
downloadyahns-9f00d864e25e35ae6cb223b66a434965b14dbdca.tar.gz
On ENAMETOOLONG and perhaps other system errors which we can do
nothing about, we should not spew a giant backtrace which could
be used as an easy DoS vector.
Diffstat (limited to 'extras')
-rw-r--r--extras/try_gzip_static.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/extras/try_gzip_static.rb b/extras/try_gzip_static.rb
index 0d5d63b..31c1aa1 100644
--- a/extras/try_gzip_static.rb
+++ b/extras/try_gzip_static.rb
@@ -203,7 +203,7 @@ class TryGzipStatic
       msg = msg.dump if /[[:cntrl:]]/ =~ msg # prevent code injection
       logger.warn("#{env['REQUEST_METHOD']} #{env['PATH_INFO']} " \
                   "#{code} #{msg}")
-      if exc.respond_to?(:backtrace)
+      if exc.respond_to?(:backtrace) && !(SystemCallError === exc)
         exc.backtrace.each { |line| logger.warn(line) }
       end
     end