Skip to content

Commit 8ff2ada

Browse files
committed
improve style
1 parent caaf7e6 commit 8ff2ada

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controls/sysctl_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,18 @@
337337
impact 1.0
338338
title 'CPU No execution Flag or Kernel ExecShield'
339339
desc 'Kernel features and CPU flags provide a protection against buffer overflows. The CPU NX Flag and the kernel parameter exec-shield prevents code execution on a per memory page basis. If the CPU supports the NX-Flag then this should be used instead of the kernel parameter exec-shield.'
340-
flags = parse_config_file('/proc/cpuinfo', assignment_re: /^([^:]*?)\s+:\s+(.*?)$/).flags.to_s.split(' ')
340+
341341
describe '/proc/cpuinfo' do
342342
it 'Flags should include NX' do
343343
expect(flags).to include('nx')
344344
end
345345
end
346+
347+
# parse for cpu flags
348+
flags = parse_config_file('/proc/cpuinfo', assignment_re: /^([^:]*?)\s+:\s+(.*?)$/).flags
349+
flags ||= ''
350+
flags = flags.split(' ')
351+
346352
unless flags.include?('nx')
347353
# if no nx flag is present, we require exec-shield
348354
describe kernel_parameter('kernel.exec-shield') do

0 commit comments

Comments
 (0)