summaryrefslogtreecommitdiffstats
path: root/src/utils/common/params.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils/common/params.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/utils/common/params.c b/src/utils/common/params.c
index 4db4b9e..d16af4c 100644
--- a/src/utils/common/params.c
+++ b/src/utils/common/params.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,7 +47,12 @@ char *name_from_idn(const char *idn_name) {
return NULL;
}
- return name;
+ if (strcasecmp(idn_name, name) == 0) {
+ free(name);
+ return strdup(idn_name);
+ } else {
+ return name;
+ }
#endif
return strdup(idn_name);
}
@@ -212,7 +217,7 @@ char *get_fqd_name(const char *name)
size_t name_len = strlen(name);
// If the name is FQDN, make a copy.
- if (name[name_len - 1] == '.') {
+ if (name_len > 0 && name[name_len - 1] == '.') {
fqd_name = strdup(name);
// Else make a copy and append a trailing dot.
} else {