config: accept domains with trailing .
authorSteven Barth <steven@midlink.org>
Sun, 15 Jun 2014 22:50:17 +0000 (00:50 +0200)
committerSteven Barth <steven@midlink.org>
Sun, 15 Jun 2014 22:50:17 +0000 (00:50 +0200)
src/config.c

index db5ca3b1772f04d4318e5e81f5cd757e1483be7b..75e9239451b4e80c859ceade540e36e9f5de898a 100644 (file)
@@ -447,7 +447,13 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                                continue;
 
                        uint8_t buf[256];
-                       int len = dn_comp(blobmsg_get_string(cur), buf, sizeof(buf), NULL, NULL);
+                       char *domain = blobmsg_get_string(cur);
+                       size_t domainlen = strlen(domain);
+                       if (domainlen > 0 && domain[domainlen - 1] == '.')
+                               domain[domainlen - 1] = 0;
+
+                       int len = dn_comp(domain, buf, sizeof(buf), NULL, NULL);
+                       free(domain);
                        if (len <= 0)
                                goto err;