diff --git a/acarsdec.c b/acarsdec.c index 4c16972..275db05 100644 --- a/acarsdec.c +++ b/acarsdec.c @@ -580,7 +580,7 @@ char * parse_params(char **paramsp, struct params_s *sp, const int np) while ((param = strsep(paramsp, ","))) { sep = strchr(param, '='); if (!sep) - continue; + return param; *sep++ = '\0'; diff --git a/fileout.c b/fileout.c index ed7201b..fe94853 100644 --- a/fileout.c +++ b/fileout.c @@ -87,7 +87,7 @@ fileout_t *Fileoutinit(char *params) retp = parse_params(¶ms, filep, ARRAY_SIZE(filep)); if (retp) { - fprintf(stderr, ERRPFX "unknown parameter '%s'\n", retp); + fprintf(stderr, ERRPFX "invalid parameter '%s'\n", retp); return NULL; } diff --git a/mqttout.c b/mqttout.c index a3f7560..bcdc2cf 100644 --- a/mqttout.c +++ b/mqttout.c @@ -50,7 +50,9 @@ mqttout_t *MQTTinit(char *params) do { retp = parse_params(¶ms, mqttp, ARRAY_SIZE(mqttp)); if (retp) { - sep = strchr(retp, '='); // guaranteed to exist due to parse_params() + sep = strchr(retp, '='); + if (!sep) + goto unknown; *sep++ = '\0'; if (!strcmp("uri", retp)) { if (url > &urls[14]) @@ -59,7 +61,8 @@ mqttout_t *MQTTinit(char *params) *url++ = sep; } else { - fprintf(stderr, ERRPFX "unknown parameter '%s'\n", retp); +unknown: + fprintf(stderr, ERRPFX "invalid parameter '%s'\n", retp); return NULL; } diff --git a/netout.c b/netout.c index 26ae380..fccafef 100644 --- a/netout.c +++ b/netout.c @@ -51,7 +51,7 @@ netout_t *Netoutinit(char *params) retp = parse_params(¶ms, netp, ARRAY_SIZE(netp)); if (retp) { - fprintf(stderr, ERRPFX "unknown parameter '%s'\n", retp); + fprintf(stderr, ERRPFX "invalid parameter '%s'\n", retp); return NULL; } diff --git a/statsd.c b/statsd.c index 49202e2..c1a3fd0 100644 --- a/statsd.c +++ b/statsd.c @@ -61,7 +61,7 @@ int statsd_init(char *params, const char *idstation) retp = parse_params(¶ms, statsdp, ARRAY_SIZE(statsdp)); if (retp) { - fprintf(stderr, ERRPFX "unknown parameter '%s'\n", retp); + fprintf(stderr, ERRPFX "invalid parameter '%s'\n", retp); return -1; }