Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rex::Version crashes in some local modules with Amazon Linux 2 kernel versions #19812

Open
h00die opened this issue Jan 17, 2025 · 0 comments · May be fixed by #19813
Open

Rex::Version crashes in some local modules with Amazon Linux 2 kernel versions #19812

h00die opened this issue Jan 17, 2025 · 0 comments · May be fixed by #19813
Assignees
Labels

Comments

@h00die
Copy link
Contributor

h00die commented Jan 17, 2025

Placeholder to link fixing several modules.

Several modules (a bunch written by me) use the following logic:

release = kernel_release
Rex::Version.new(release)

This works great on most Ubuntu systems, Fedora, etc. However, Amazon Linux 2 has kernel versions like 5.4.129-72.229.amzn2int.x86_64 (ref)

>> Rex::Version.new('5.4.129-72.229.amzn2int.x86_64')
/usr/lib/ruby/vendor_ruby/rubygems/version.rb:223:in `initialize': Malformed version number string 5.4.129-72.229.amzn2int.x86_64 (ArgumentError)

So we'll need to do better about guarding like so:

require 'rex/version'

begin
  Rex::Version.new('5.4.129-72.229.amzn2int.x86_64')
rescue ArgumentError => e
  puts "Error reading invalid version: #{e}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant