diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-03 17:42:54 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-03 17:42:54 +0200 |
commit | 4aac65c4b8f2d8415ca8d9d8449e0158e0ff1e9c (patch) | |
tree | 609b2e2349371006e37c9112c9ceebbbffe45950 /src/blogc.c | |
parent | c23d58aaec79938f29cdac8336d4dcd46cc346ab (diff) | |
download | blogc-4aac65c4b8f2d8415ca8d9d8449e0158e0ff1e9c.tar.gz blogc-4aac65c4b8f2d8415ca8d9d8449e0158e0ff1e9c.tar.bz2 blogc-4aac65c4b8f2d8415ca8d9d8449e0158e0ff1e9c.zip |
blogc: added utf8 validation
Diffstat (limited to 'src/blogc.c')
-rw-r--r-- | src/blogc.c | 6 |
1 files changed, 6 insertions, 0 deletions
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]) { |