[proxy.php] Regular expression parity check incorrect for in_the_net

  • ページ: BugTrack2
  • 投稿者: JordanC
  • 優先順位: 低
  • 状態: 却下
  • カテゴリー: 本体バグ
  • 投稿日: 2008-04-24 (木) 03:49:44
  • バージョン:


Because the regular expression used as PKWK_CIDR_NETWORK_REGEX is the following:


Which shorthands to:


An invalid IP address can be used in this check, but it's somewhat of a limitation of brackets for recursion. The following IP addresses are valid with the above regular expression as \d refers to numeric data.

The following IP addresses are valid with the regular expression used:


Again, it's not a HUGE thing but it will throw an error and waste processing time when ip2long is called and the (erroneous) IP address is used.


  • A regex which will correct this is, of course - "\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" :) -- JordanC 2008-04-24 (木) 03:53:23
  • Probably could reduce that to.. "((2[0-5][0-5]|1[0-9][0-9])\.){3}((2[0-5][0-5]|1[0-9][0-9])\.?){1}" -- JordanC 2008-04-24 (木) 04:02:30
  • Yeah, these are just rough, for addresses like due to the minimums and all that. Haven't got a regex checker here, folks :( -- JordanC 2008-04-24 (木) 04:04:36

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2008-04-24 (木) 19:53:00
Site admin: PukiWiki Development Team

PukiWiki 1.5.2+ © 2001-2019 PukiWiki Development Team. Powered by PHP 5.6.40-0+deb8u8. HTML convert time: 0.132 sec.