User Tools

Site Tools


ja:rule:num:データ型を指定する場合はデータの表現可能範囲に注意する

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ja:rule:num:データ型を指定する場合はデータの表現可能範囲に注意する [2016/03/20 00:03] – created yohgakija:rule:num:データ型を指定する場合はデータの表現可能範囲に注意する [2016/03/20 00:04] (current) – [適合コード例(String type)] yohgaki
Line 52: Line 52:
 } }
  
 +// There should be arbitrary length limit validation
 +if (strspn(strlen($_GET['id']) > 100) {
 +  throw new Exception('Invalid integer format');
 +}
 +// Validate $_GET['id'] contains only 0 to 9 chars
 +if (strspn($_GET['id'], '0123456789') !== strlen($_GET['id'])) {
 +  throw new Exception('Invalid integer format');
 +}
 $ret = findRecord($_GET['id']); $ret = findRecord($_GET['id']);
  
ja/rule/num/データ型を指定する場合はデータの表現可能範囲に注意する.1458432217.txt.gz · Last modified: 2016/03/20 00:03 by yohgaki

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki