deny mqtttopic starting with '/' (fixes #960)

This commit is contained in:
John
2023-08-06 08:26:25 +02:00
parent c5bf9754fe
commit 949b366fe6
+1 -1
View File
@@ -195,7 +195,7 @@ static error_t mqtt_parse_opt(int key, char *arg, struct argp_state *state) {
case O_TOPI: // --mqtttopic=ebusd 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"); argp_error(state, "invalid mqtttopic");
return EINVAL; return EINVAL;
} }