From: Robert Lipe Date: Tue, 9 Oct 2018 03:27:05 +0000 (+0000) Subject: Allow string to be modified during parse. Ugh. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~115^2~1^2~84^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7aaa6f121b8c60c00aa7d092ad1ccb361a92dd05;p=gpsbabel.git Allow string to be modified during parse. Ugh. --- diff --git a/csv_util.cc b/csv_util.cc index 67854121a..ba1685ed2 100644 --- a/csv_util.cc +++ b/csv_util.cc @@ -1441,8 +1441,9 @@ xcsv_data_read(void) } if (!buff.isEmpty()) { Waypoint* wpt_tmp = new Waypoint; - - const char* s = strdup(CSTR(buff)); + // tbuf is a temporary copy of buff since we modify it. :-( + char *tbuf = xstrdup(buff); + const char* s = tbuf; s = csv_lineparse(s, CSTR(xcsv_file.field_delimiter), CSTR(xcsv_file.field_encloser), linecount); @@ -1518,6 +1519,7 @@ xcsv_data_read(void) default: ; } + xfree(tbuf); } } }