Skip to content

Commit

Permalink
🪲 protect against bad filenames with multiple .c instances in them (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandervoord committed Mar 23, 2024
1 parent 001bbec commit 714619e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cmock_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def create_mock_header_footer(header)
end

def create_source_header_section(file, filename, mock_project)
header_file = (mock_project[:folder] || '') + filename.gsub('.c', mock_project[:module_ext])
header_file = (mock_project[:folder] || '') + filename.sub(/.*\K\.c/, mock_project[:module_ext])
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" unless mock_project[:parsed_stuff][:functions].empty?
file << "#include <string.h>\n"
file << "#include <stdlib.h>\n"
Expand Down

0 comments on commit 714619e

Please sign in to comment.