Skip to content

Commit

Permalink
Check for string before copying
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Haskel committed Feb 19, 2015
1 parent fcd2f53 commit b693c87
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/puppet/parser/functions/is_domain_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ module Puppet::Parser::Functions
"given #{arguments.size} for 1")
end

# Only allow string types
return false unless arguments[0].is_a?(String)

domain = arguments[0].dup

# Limits (rfc1035, 3.1)
domain_max_length=255
label_min_length=1
label_max_length=63

# Only allow string types
return false unless domain.is_a?(String)

# Allow ".", it is the top level domain
return true if domain == '.'

Expand Down

0 comments on commit b693c87

Please sign in to comment.