From 13044f9c8d5757b6885d78cb5f7f37770e3750ab Mon Sep 17 00:00:00 2001 From: Michael Budde Date: Sat, 23 Feb 2019 14:36:43 +0100 Subject: Reject postings with comment after flag Fixes #1753 --- doc/NEWS.md | 2 ++ src/textual.cc | 2 +- test/regress/1753.test | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 test/regress/1753.test diff --git a/doc/NEWS.md b/doc/NEWS.md index 8b3ec1fc..ce468b7f 100644 --- a/doc/NEWS.md +++ b/doc/NEWS.md @@ -2,6 +2,8 @@ ## 3.1.3 (unreleased) +- Properly reject postings with a comment right after the flag (bug #1753) + - Make sorting order of lot information deterministic (bug #1747) - Remove the `org` command, which was always a hack to begin with (bug #1706) diff --git a/src/textual.cc b/src/textual.cc index 04e90e45..258e2560 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1440,7 +1440,7 @@ post_t * instance_t::parse_post(char * line, // Parse the account name - if (! *p) + if (! *p || *p == ';') throw parse_error(_("Posting has no account")); char * next = next_element(p, true); diff --git a/test/regress/1753.test b/test/regress/1753.test new file mode 100644 index 00000000..4df9851b --- /dev/null +++ b/test/regress/1753.test @@ -0,0 +1,12 @@ +2018-01-02 * Account name starting with semicolon + * ;A 10.00 EUR + B + +test reg -> 1 +__ERROR__ +While parsing file "$FILE", line 2: +While parsing posting: + * ;A 10.00 EUR + +Error: Posting has no account +end test -- cgit v1.2.3