• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revision15e57122d27c5a3a76d23e613c4add724eab9d2a (tree)
Time2019-01-13 23:16:53
Authordhrname <dhrname@user...>
Commiterdhrname

Log Message

New ST_readFile

Change Summary

Incremental Difference

--- a/source_code/shadowstar.c
+++ b/source_code/shadowstar.c
@@ -1292,3 +1292,27 @@ void ST_freenode (ST_Free_Node freelist)
12921292 free(freelist);
12931293 freelist = NULL;
12941294 }
1295+
1296+/*ST_readFile 関数
1297+ * 引数nameで指定された名前のファイルの読み込みを行う*/
1298+void ST_readFile(const char *name)
1299+{
1300+ FILE *fp;
1301+ if ( (fp = fopen(name, "r")) == NULL )
1302+ {
1303+ eprintf("Fail reading that file\n");
1304+ }
1305+
1306+ /*EOFと文字データの区別ができない脆弱性対策 (以下を参照)
1307+ * 「FIO34-C. ファイルから読み込んだ文字と EOF や WEOF を区別する」
1308+ * https://www.jpcert.or.jp/sc-rules/c-fio34-c.html*/
1309+ if (feof(stdin)) {
1310+
1311+ } else if (ferror(stdin)) {
1312+
1313+ } else {
1314+ /* EOF を入力として受け取っていた場合の処理 */
1315+ }
1316+
1317+ fclose(fp);
1318+}
--- a/source_code/shadowstar.h
+++ b/source_code/shadowstar.h
@@ -52,3 +52,7 @@ typedef struct ST_Text_Code {
5252 ST_Token_Mode* array; /*トークンモードの配列*/
5353 uint_fast32_t pos; /*現在のソースコードの位置*/
5454 } ST_Text_Code;
55+
56+/*ST_readFile 関数
57+ * 引数nameで指定された名前のファイルの読み込みを行う*/
58+void ST_readFile(const char *);
Binary files a/source_code/shadowstar.o and b/source_code/shadowstar.o differ