summaryrefslogtreecommitdiffstats
path: root/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/run_event.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/utils/run_event.c b/lib/utils/run_event.c
index e89d1040..45e4bf86 100644
--- a/lib/utils/run_event.c
+++ b/lib/utils/run_event.c
@@ -57,13 +57,16 @@ int run_event(struct run_event_state *state,
{
char *end_word = skip_non_whitespace(p);
char *next_word = skip_whitespace(end_word);
- *end_word = '\0';
+
+ /* *end_word = '\0'; - BUG, truncates command */
/* If there is no '=' in this word... */
char *line_val = strchr(p, '=');
- if (!line_val)
+ if (!line_val || line_val >= end_word)
break; /* ...we found the start of a command */
+ *end_word = '\0';
+
/* Current word has VAR=VAL form. line_val => VAL */
*line_val++ = '\0';