• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン90dcd408d311b215a15ee6a96f1f965540189846 (tree)
日時2005-01-30 21:02:37
作者henoheno <henoheno>
コミッターhenoheno

ログメッセージ

Check PKWK_QUERY_STRING_MAX

変更サマリ

差分

--- a/plugin/attach.inc.php
+++ b/plugin/attach.inc.php
@@ -1,6 +1,6 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone
3-// $Id: attach.inc.php,v 1.70 2005/01/23 07:01:56 henoheno Exp $
3+// $Id: attach.inc.php,v 1.71 2005/01/30 12:02:37 henoheno Exp $
44 //
55 // File attach plugin
66
@@ -99,7 +99,6 @@ function plugin_attach_action()
9999 // Dispatch
100100 if (isset($_FILES['attach_file'])) {
101101 // Upload
102- if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
103102 return attach_upload($_FILES['attach_file'], $refer, $pass);
104103 }
105104 switch ($pcmd) {
@@ -149,8 +148,18 @@ function attach_upload($file, $page, $pass = NULL)
149148 {
150149 global $_attach_messages;
151150
152- if (! is_page($page)) {
153- die_message("No such page");
151+ if (PKWK_READONLY) die_message('PKWK_READONLY prohibits editing');
152+
153+ // Check query-string
154+ $query = 'plugin=attach&amp;pcmd=info&amp;refer=' . rawurlencode($page) .
155+ '&amp;file=' . rawurlencode($file['name']);
156+
157+ if (PKWK_QUERY_STRING_MAX && strlen($query) > PKWK_QUERY_STRING_MAX) {
158+ pkwk_common_headers();
159+ echo('Query string (page name and/or file name) too long');
160+ exit;
161+ } else if (! is_page($page)) {
162+ die_message('No such page');
154163 } else if ($file['tmp_name'] == '' || ! is_uploaded_file($file['tmp_name'])) {
155164 return array('result'=>FALSE);
156165 } else if ($file['size'] > PLUGIN_ATTACH_MAX_FILESIZE) {
@@ -169,18 +178,15 @@ function attach_upload($file, $page, $pass = NULL)
169178 }
170179
171180 $obj = & new AttachFile($page, $file['name']);
172- if ($obj->exist) {
181+ if ($obj->exist)
173182 return array('result'=>FALSE,
174183 'msg'=>$_attach_messages['err_exists']);
175- }
176184
177- if (move_uploaded_file($file['tmp_name'], $obj->filename)) {
185+ if (move_uploaded_file($file['tmp_name'], $obj->filename))
178186 chmod($obj->filename, PLUGIN_ATTACH_FILE_MODE);
179- }
180187
181- if (is_page($page)) {
188+ if (is_page($page))
182189 touch(get_filename($page));
183- }
184190
185191 $obj->getstatus();
186192 $obj->status['pass'] = ($pass !== TRUE && $pass !== NULL) ? md5($pass) : '';