Skip to content

Commit 1ad7564

Browse files
committed
don't allow \x00 in diff filenames
1 parent 4323bb7 commit 1ad7564

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/coderay/scanners/diff.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def scan_tokens encoder, options
4545
if match = scan(/--- |\+\+\+ |=+|_+/)
4646
encoder.begin_line line_kind = :head
4747
encoder.text_token match, :head
48-
if match = scan(/.+?(?=$|[\t\n\x00]| \(revision)/)
48+
if match = scan(/[^\x00\n]+?(?=$|[\t\n]| \(revision)/)
4949
encoder.text_token match, :filename
5050
if options[:highlight_code] && match != '/dev/null'
5151
file_type = CodeRay::FileType.fetch(match, :text)

0 commit comments

Comments
 (0)