diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-03-18 13:42:50 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-03-18 14:51:56 +0000 |
commit | 36cb30d47d84619c41cfea755a6122f3c2e7c75c (patch) | |
tree | eb8bc1dd6e4914cb724a92f521c9ded6be440cc3 | |
parent | 1b7bf5b18299e65285c66bb498d181c2ccc2813e (diff) |
Check that LOGGER macros are only called with string literals.
Avoid any dynamic format strings, even ones like `cond ? "str1" : "str2"`.
-rw-r--r-- | toxcore/network.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index d6d5bfd4..da51fdc3 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -871,8 +871,13 @@ Networking_Core *new_networking_ex(const Logger *log, IP ip, uint16_t port_from, | |||
871 | 871 | ||
872 | int neterror = net_error(); | 872 | int neterror = net_error(); |
873 | const char *strerror = net_new_strerror(neterror); | 873 | const char *strerror = net_new_strerror(neterror); |
874 | LOGGER_DEBUG(log, res < 0 ? "Failed to activate local multicast membership. (%d, %s)" : | 874 | |
875 | "Local multicast group FF02::1 joined successfully. (%d, %s)", neterror, strerror); | 875 | if (res < 0) { |
876 | LOGGER_DEBUG(log, "Failed to activate local multicast membership. (%d, %s)", neterror, strerror); | ||
877 | } else { | ||
878 | LOGGER_DEBUG(log, "Local multicast group FF02::1 joined successfully. (%d, %s)", neterror, strerror); | ||
879 | } | ||
880 | |||
876 | net_kill_strerror(strerror); | 881 | net_kill_strerror(strerror); |
877 | } | 882 | } |
878 | 883 | ||