From 949b366fe62d320f85f518aac236ceed8cd0d688 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 6 Aug 2023 08:26:25 +0200 Subject: [PATCH] deny mqtttopic starting with '/' (fixes #960) --- src/ebusd/mqtthandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ebusd/mqtthandler.cpp b/src/ebusd/mqtthandler.cpp index a4adac49..d8969d92 100755 --- a/src/ebusd/mqtthandler.cpp +++ b/src/ebusd/mqtthandler.cpp @@ -195,7 +195,7 @@ static error_t mqtt_parse_opt(int key, char *arg, struct argp_state *state) { case O_TOPI: // --mqtttopic=ebusd { - if (arg == nullptr || arg[0] == 0 || strchr(arg, '+') || arg[strlen(arg)-1] == '/') { + if (arg == nullptr || arg[0] == 0 || arg[0] == '/' || strchr(arg, '+') || arg[strlen(arg)-1] == '/') { argp_error(state, "invalid mqtttopic"); return EINVAL; }