From: Morgan Haskel Date: Thu, 19 Feb 2015 20:01:26 +0000 (-0800) Subject: Check for string before copying X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=b693c870d20f8bf0c574b9581a92ce3842fb3c05;p=puppet-stdlib.git Check for string before copying --- diff --git a/lib/puppet/parser/functions/is_domain_name.rb b/lib/puppet/parser/functions/is_domain_name.rb index 24cc208..2860ded 100644 --- a/lib/puppet/parser/functions/is_domain_name.rb +++ b/lib/puppet/parser/functions/is_domain_name.rb @@ -13,6 +13,9 @@ Returns true if the string passed to this function is a syntactically correct do "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) @@ -20,9 +23,6 @@ Returns true if the string passed to this function is a syntactically correct do 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 == '.'