Skip to content

Commit 4b67fe0

Browse files
committed
handle filenames with embedded space characters
Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
1 parent c85fa5c commit 4b67fe0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

parse_config.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ bool parse_config_line(char *line, mapping_list_t *list,
197197
uint32_t gpio_mask = 0;
198198
mapping_t *existing_mapping, new_mapping;
199199

200+
buffer[0] = '\0';
200201
token = strtok_r(line, " \t", &next_token);
201202
while (token != NULL) {
202203
switch (state) {
@@ -288,7 +289,10 @@ bool parse_config_line(char *line, mapping_list_t *list,
288289
}
289290
case STATE_LOAD:
290291
case STATE_TYPE:
291-
strncpy(buffer, token, MAX_LINE_LENGTH);
292+
if (buffer[0] != '\0') {
293+
strncat(buffer, " ", MAX_LINE_LENGTH);
294+
}
295+
strncat(buffer, token, MAX_LINE_LENGTH);
292296
break;
293297

294298

0 commit comments

Comments
 (0)