diff --git a/src/common.c b/src/common.c index 566df0f44..4ce440a51 100644 --- a/src/common.c +++ b/src/common.c @@ -368,6 +368,9 @@ bool parse_value(type_t type, const char *str, parsed_value_t *value) *p = toupper_iso88591(*p); *p = '\0'; + if (p == copy) + return false; + ident_t id = ident_new(copy); value->integer = -1; diff --git a/test/test_value.c b/test/test_value.c index d8688f6f0..e29b10aae 100644 --- a/test/test_value.c +++ b/test/test_value.c @@ -180,6 +180,8 @@ START_TEST(test_physical) fail_unless(parse_value(t, " 3 ps ", &v)); ck_assert_int_eq(v.integer, 3000); + + fail_if(parse_value(t, " 5", &v)); } END_TEST