From: Jesse Luehrs Date: Tue, 6 Sep 2011 01:17:03 +0000 (-0500) Subject: don't allow variable names that contain :: X-Git-Tag: 0.24~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ff84a326d0d713e63382bbe164adbb6b4902a1b;p=gitmo%2FPackage-Stash-XS.git don't allow variable names that contain :: --- diff --git a/XS.xs b/XS.xs index 8c84081..60775b7 100644 --- a/XS.xs +++ b/XS.xs @@ -235,6 +235,13 @@ static void _deconstruct_variable_hash(HV *variable, varspec_t *varspec) varspec->type = string_to_vartype(SvPV_nolen(HeVAL(val))); } +static void _check_varspec_is_valid(varspec_t *varspec) +{ + if (strstr(SvPV_nolen(varspec->name), "::")) { + croak("Variable names may not contain ::"); + } +} + static int _valid_for_type(SV *value, vartype_t type) { svtype sv_type = SvROK(value) ? SvTYPE(SvRV(value)) : SVt_NULL; diff --git a/typemap b/typemap index 8fd59c8..fc3c031 100644 --- a/typemap +++ b/typemap @@ -10,6 +10,7 @@ T_VARSPEC _deconstruct_variable_hash((HV*)SvRV($arg), &$var); else croak(\"varspec must be a string or a hashref\"); + _check_varspec_is_valid(&$var); T_VARTYPE if (!SvPOK($arg))