Skip to content

Commit

Permalink
fix:maptool:skip changeset elements and their tags in the osm xml fil…
Browse files Browse the repository at this point in the history
…e. (#1193)

Deny <tag k=... v=..> processing before first <node> element is read.
Let maptool silently skip <boundary> and <changeset>  elements
  • Loading branch information
mdankov committed Jul 25, 2022
1 parent 0eb1e22 commit 0338c1f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions navit/maptool/osm_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ int map_collect_data_osm(FILE *in, struct maptool_osm *osm) {
int size=BUFFER_SIZE;
char buffer[BUFFER_SIZE];
char *p;
int process_tags=0;
sig_alrm(0);
if (!fgets(buffer, size, in) || !xml_declaration_in_line(buffer)) {
fprintf(stderr,"FATAL: First line does not start with XML declaration;\n"
Expand All @@ -188,11 +189,17 @@ int map_collect_data_osm(FILE *in, struct maptool_osm *osm) {
}
if (!strncmp(p, "<osm ",5)) {
} else if (!strncmp(p, "<bound ",7)) {
} else if (!strncmp(p, "<boundary ",10)) {
} else if (!strncmp(p, "<changeset ",11)) {
} else if (!strncmp(p, "</changeset>",12)) {
} else if (!strncmp(p, "<node ",6)) {
if (!parse_node(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
processed_nodes++;
process_tags=1;
} else if (!strncmp(p, "<tag ",5)) {
if (!process_tags)
continue;
if (!parse_tag(p))
fprintf(stderr,"WARNING: failed to parse %s\n", buffer);
} else if (!strncmp(p, "<way ",5)) {
Expand Down

0 comments on commit 0338c1f

Please sign in to comment.