aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-07-04 20:20:36 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-07-04 20:20:36 +0200
commit4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b (patch)
tree421cf5fe6d79dafdb0b8d319e4bdf1e7bbebbdb8 /src/blogc.c
parent82d4d0f0cfc47a5b4520cf631290f8ced08a0f04 (diff)
downloadblogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.tar.gz
blogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.tar.bz2
blogc-4c228763c31255ea9bd3cd1bbd93f5cf7ab9f54b.zip
blogc: only -D arguments must be validated for UTF-8
Diffstat (limited to 'src/blogc.c')
-rw-r--r--src/blogc.c10
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 "