diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-04 20:20:36 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-04 20:20:36 +0200 |
commit | 4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b (patch) | |
tree | 421cf5fe6d79dafdb0b8d319e4bdf1e7bbebbdb8 | |
parent | 82d4d0f0cfc47a5b4520cf631290f8ced08a0f04 (diff) | |
download | blogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.tar.gz blogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.tar.bz2 blogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.zip |
blogc: only -D arguments must be validated for UTF-8
-rw-r--r-- | src/blogc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/blogc.c b/src/blogc.c index 4606740..20e1756 100644 --- a/src/blogc.c +++ b/src/blogc.c @@ -126,11 +126,6 @@ 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]) { @@ -170,6 +165,11 @@ main(int argc, char **argv) else if (i + 1 < argc) tmp = argv[++i]; if (tmp != NULL) { + if (!blogc_utf8_validate((uint8_t*) tmp, strlen(tmp))) { + fprintf(stderr, "blogc: error: invalid value for " + "-D (must be valid UTF-8 string): %s\n", tmp); + goto cleanup; + } pieces = sb_str_split(tmp, '=', 2); if (sb_strv_length(pieces) != 2) { fprintf(stderr, "blogc: error: invalid value for " |