X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Ftoken.c;h=aa0a620e98b3033d95af87bdb73a65da7e3c5ebc;hp=35ddbf741416d0b55852b1355307e755ef87964f;hb=ffe8e22a52a385d795889c5cabbde2f277342e32;hpb=0e3065564e83037d5fbbb3e0e1595e7ce95ce8eb diff --git a/src/token.c b/src/token.c index 35ddbf7..aa0a620 100644 --- a/src/token.c +++ b/src/token.c @@ -10,14 +10,14 @@ OPD *opdtok(const char *str) bool quoting = false; opd->opdc = 0; - if(str == NULL || strlen(str) == 0) { + if(str == NULL) { return opd; } p = q = strdup(str); do { /* オペランド数が多すぎる場合はエラー */ if(opd->opdc >= OPDSIZE) { - setcerr(117, NULL); /* operand is too many */ + setcerr(117, str); /* operand is too many */ break; } /* 先頭が「=」の場合の処理 */ @@ -29,6 +29,11 @@ OPD *opdtok(const char *str) quoting = !quoting; } if(quoting == true) { + /* 閉じ「'」がないまま文字列が終了した場合 */ + if(*q == '\0') { + setcerr(123, str); /* illegal string */ + break; + } q++; } else { sepp = q + strcspn(q, ", ");