From 26bade2280bd767a2d0a5df66f78462df64586be Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 10 Sep 2019 15:44:30 +0200 Subject: do not crash on missing space --- udp514-journal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udp514-journal.c b/udp514-journal.c index b73f992..9783db8 100644 --- a/udp514-journal.c +++ b/udp514-journal.c @@ -49,7 +49,9 @@ int main(int argc, char **argv) { /* parse priority */ if ((match = strndup(buffer, BUFFER_SIZE)) != NULL) { - *strchr(match, ' ') = 0; + char * space = strchr(match, ' '); + if (space != NULL) + *space = 0; for (pri = prioritynames; pri->c_name && strstr(match, pri->c_name) == NULL; pri++); free(match); priority = pri->c_val; -- cgit v1.2.3-70-g09d2