From 4aac65c4b8f2d8415ca8d9d8449e0158e0ff1e9c Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 3 Jul 2016 17:42:54 +0200 Subject: blogc: added utf8 validation --- src/blogc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/blogc.c') diff --git a/src/blogc.c b/src/blogc.c index 40a5918..4606740 100644 --- a/src/blogc.c +++ b/src/blogc.c @@ -30,6 +30,7 @@ #include "loader.h" #include "renderer.h" #include "error.h" +#include "utf8.h" #include "utils.h" #ifndef PACKAGE_VERSION @@ -125,6 +126,11 @@ main(int argc, char **argv) sb_trie_insert(config, "BLOGC_VERSION", sb_strdup(PACKAGE_VERSION)); for (unsigned int i = 1; i < argc; i++) { + if (!blogc_utf8_validate((uint8_t*) argv[i], strlen(argv[i]))) { + fprintf(stderr, "blogc: error: command-line argument is not utf8-" + "encoded: %s\n", argv[i]); + goto cleanup; + } tmp = NULL; if (argv[i][0] == '-') { switch (argv[i][1]) { -- cgit v1.2.3-18-g5258