Skip to content
Snippets Groups Projects
Verified Commit 666947db authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

dnstap: avoid a false-positive warning

../modules/dnstap/dnstap.c: In function 'dnstap_config':
../modules/dnstap/dnstap.c:410:29: warning: 'strndup' specified bound 4096 exceeds source size 17 [-Wstringop-overread]
  410 |                 sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
      |                             ^
../modules/dnstap/dnstap.c:423:37: warning: 'strndup' specified bound 4096 exceeds source size 17 [-Wstringop-overread]
  423 |                         sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
      |                                     ^

We don't need to restrict our built-in path defaults to PATH_MAX
characters, as they just can't be that long and it's not an issue if we
shoot over it anyway - opening such a file would only fail.
parent 1dd6fdb8
Branches
Tags
No related merge requests found
......@@ -409,7 +409,7 @@ int dnstap_config(struct kr_module *module, const char *conf) {
/* Empty conf passed, set default */
if (!conf || strlen(conf) < 1) {
sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
sock_path = strdup(DEFAULT_SOCK_PATH);
} else {
JsonNode *root_node = json_decode(conf);
......@@ -422,7 +422,7 @@ int dnstap_config(struct kr_module *module, const char *conf) {
/* dnstapPath key */
node = json_find_member(root_node, CFG_SOCK_PATH);
if (!node || find_string(node, &sock_path, PATH_MAX) != kr_ok()) {
sock_path = strndup(DEFAULT_SOCK_PATH, PATH_MAX);
sock_path = strdup(DEFAULT_SOCK_PATH);
}
/* identity string key */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment