Skip to content

Commit

Permalink
Fixing ReDoS in header parsing
Browse files Browse the repository at this point in the history
Thanks svalkanov

[CVE-2024-26146]
  • Loading branch information
tenderlove committed Feb 21, 2024
1 parent f169ff7 commit e4c1177
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rack/utils.rb
Expand Up @@ -142,8 +142,8 @@ def build_nested_query(value, prefix = nil)
end

def q_values(q_value_header)
q_value_header.to_s.split(/\s*,\s*/).map do |part|
value, parameters = part.split(/\s*;\s*/, 2)
q_value_header.to_s.split(',').map do |part|
value, parameters = part.split(';', 2).map(&:strip)
quality = 1.0
if parameters && (md = /\Aq=([\d.]+)/.match(parameters))
quality = md[1].to_f
Expand Down

0 comments on commit e4c1177

Please sign in to comment.