From 8518d08ff3c5864c8d8009f949ee5b1e716f8ddb Mon Sep 17 00:00:00 2001 From: Till Zimmermann Date: Thu, 9 May 2019 13:08:19 +0200 Subject: [PATCH] Fixed Segmentation Fault / NULLptr dereference Signed-off-by: Till Zimmermann --- client/client_shared.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/client_shared.c b/client/client_shared.c index 8569651d..b1cbd7bb 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -662,6 +662,10 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c return 1; } topic = strchr(url, '/'); + if(!topic){ + fprintf(stderr, "Error: invalid URL for -L argument specified.\n\n"); + return 1; + } *topic++ = 0; if(cfg_add_topic(cfg, pub_or_sub, topic, "-L topic"))