Fix bug #12: asserts in adc_msg_parse -> enabled strict utf8 parsing.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
Jan Vidar Krey
2009-03-23 21:47:05 +01:00
parent ab4eb6db3d
commit 7aeb8651ba
5 changed files with 39 additions and 9 deletions

View File

@@ -26,8 +26,6 @@
uhub_assert(X->capacity); \
uhub_assert(X->length); \
uhub_assert(X->length <= X->capacity); \
if (X->length != strlen(X->cache)) \
hub_log(log_error, "Assert: X->length (%d) != strlen(X->cache) (%d)", X->length, strlen(X->cache)); \
uhub_assert(X->length == strlen(X->cache)); \
uhub_assert(X->references >= 0);
#else
@@ -265,6 +263,13 @@ struct adc_message* adc_msg_parse(const char* line, size_t length)
if (command == NULL)
return NULL; /* OOM */
if (!is_printable_utf8(line, length))
{
hub_log(log_debug, "Dropped message with non-printable UTF-8 characters.");
hub_free(command);
return NULL;
}
if (line[length-1] != '\n')
{