]> granicus.if.org Git - onig/commitdiff
strict check in is_allowed_callout_name()
authorK.Kosako <kosako@sofnec.co.jp>
Wed, 28 Feb 2018 07:51:51 +0000 (16:51 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 28 Feb 2018 07:51:51 +0000 (16:51 +0900)
src/regparse.c

index cb4d6b44282299d0fcdf09fd462bb65eda5d080a..c9697e93de8ed581f9774f22cdbf5d580166dfdb 100644 (file)
@@ -1442,12 +1442,18 @@ is_allowed_callout_name(OnigEncoding enc, UChar* name, UChar* name_end)
   UChar* p;
   OnigCodePoint c;
 
+  if (name >= name_end) return 0;
+
   p = name;
   while (p < name_end) {
     c = ONIGENC_MBC_TO_CODE(enc, p, name_end);
     if (! IS_ALLOWED_CODE_IN_CALLOUT_NAME(c))
       return 0;
 
+    if (p == name) {
+      if (c >= '0' && c <= '9') return 0;
+    }
+
     p += ONIGENC_MBC_ENC_LEN(enc, p);
   }