Skip to content

Commit

Permalink
bsc#1045098: Fix regular expression to check alloc_mem parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilson Souza committed Jun 21, 2017
1 parent 2a7a439 commit b936250
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clients/kdump.rb
Expand Up @@ -735,20 +735,20 @@ def cmdKdumpShow(options)


# Only numbers are allowed as allow_mem_high and allow_mem_low values
ALLOC_MEM_REGEXP = /\D/
ALLOC_MEM_REGEXP = /\A\d+\z/

def cmdKdumpStartup(options)
options = deep_copy(options)
if Ops.get(options, "enable") != nil &&
Ops.get(options, "alloc_mem") != nil
Kdump.add_crashkernel_param = true
alloc_mem_low, alloc_mem_high = options["alloc_mem"].split(',')
Kdump.allocated_memory = { low: alloc_mem_low, high: alloc_mem_high }
unless alloc_mem_low =~ ALLOC_MEM_REGEXP &&
(alloc_mem_high.nil? || alloc_mem_high =~ ALLOC_MEM_REGEXP)
CommandLine.Error(_("Invalid allocation memory parameter"))
return false
end
Kdump.add_crashkernel_param = true
Kdump.allocated_memory = { low: alloc_mem_low, high: alloc_mem_high }
#TRANSLATORS: CommandLine printed text
if Kdump.crashkernel_list_ranges
CommandLine.Print(
Expand Down

0 comments on commit b936250

Please sign in to comment.