summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--udp514-journal.c4
1 files changed, 3 insertions, 1 deletions
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;