From a4b043c3f053c7ada8bb2b2b13ce8343f36c5aa2 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 17 Mar 2018 14:10:56 -0700 Subject: [PATCH] Bug 794236 - Import a log file The crash was caused by the timezone constructor encountering a newline on the timezone. Prevent this by removing all whitespace from the end of the input string. --- gnucash/import-export/log-replay/gnc-log-replay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gnucash/import-export/log-replay/gnc-log-replay.c b/gnucash/import-export/log-replay/gnc-log-replay.c index d79fa2278e..00bbb2bff5 100644 --- a/gnucash/import-export/log-replay/gnc-log-replay.c +++ b/gnucash/import-export/log-replay/gnc-log-replay.c @@ -384,11 +384,13 @@ static void process_trans_record( FILE *log_file) while ( record_ended == FALSE) { read_retval = fgets(read_buf, sizeof(read_buf), log_file); - if (read_retval != NULL && strncmp(record_end_str, read_buf, strlen(record_end_str)) != 0) /* If we are not at the end of the record */ + if (read_retval != NULL && + strncmp(record_end_str, read_buf, strlen(record_end_str)) != 0) /* If we are not at the end of the record */ { split_num++; /*DEBUG("process_trans_record(): Line read: %s%s",read_buf ,"\n");*/ - record = interpret_split_record( read_buf); + + record = interpret_split_record(g_strchomp(read_buf)); dump_split_record( record); if (record.log_action_present) {