Skip to content

Commit

Permalink
タグ入力の内、タグ分解部分だけじゃなくて標準入力界面にもサイズチェックを入れた
Browse files Browse the repository at this point in the history
これを入れないと、例えば改行でない同じ文字が無限に入力された時、レコードを分解できずサイズチェックが働かない。
サイズチェックをタグ分解部分とわざわざ分けているのは空白からのみなる行を無視する動作があるため。
  • Loading branch information
hcmiya committed Aug 19, 2017
1 parent 9418add commit 1ae1dcc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions nls/ja_JP.UTF-8/2.mainerror
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ $set 2
8 ファイル指定がない
9 ファイル指定が多い
10 保存出来るタグの長さが上限を超えた(%uMiBまで)
11 編集入力が長過ぎる。変なコマンドを挟んでいませんか?
1 change: 1 addition & 0 deletions nls/ja_JP.eucJP/2.mainerror
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ $set 2
8 �ե�������꤬�ʤ�
9 �ե�������꤬¿��
10 ��¸����륿����Ĺ������¤�Ķ����(%uMiB�ޤ�)
11 �Խ����Ϥ�Ĺ�᤮�롣�Ѥʥ��ޥ�ɤ򶴤�Ǥ��ޤ���?
6 changes: 5 additions & 1 deletion parse-tags.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ static void *toutf8(void *fdu8_) {
}
}
size_t readlen, remain, total;
remain = 0;
remain = 0; total = 0;
while ((readlen = fread(&lbuf[remain], 1, buflen - remain, stdin)) != 0) {
total += readlen;
if (total > TAG_LENGTH_LIMIT__INPUT) {
mainerror(catgets(catd, 2, 11, "編集入力が長過ぎる。変なコマンドを挟んでいませんか?"));
}
if (strnlen(&lbuf[remain], readlen) != readlen) {
err_bin();
}
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define OPUSCOMMENT_VERSION "1.0.1"
#define OPUSCOMMENT_VERSION "1.0.2"

#define OPUSCOMMENT_REVISION_YEAR (2017 - 1900)
#define OPUSCOMMENT_REVISION_MONTH (8 - 1)
Expand Down

0 comments on commit 1ae1dcc

Please sign in to comment.