make sure to NUL terminate node id, lat and lon - osm-zipcodes - Extract (dutch) addresses from OpenStreetMap OSM XML
(HTM) git clone git://git.codemadness.org/osm-zipcodes
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit efc8ce2336540cc2c83611db5199c392e36cb703
(DIR) parent 3a885c2dba525f3ab48c20ab258afe35addadd5e
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 21 Nov 2018 17:34:49 +0100
make sure to NUL terminate node id, lat and lon
previous data in the buffer was used
Diffstat:
M main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/main.c b/main.c
@@ -171,14 +171,14 @@ xmlattr(XMLParser *x, const char *t, size_t tl,
if (isnode && !istag) {
if (al == 2 && a[0] == 'i' && a[1] == 'd' && vl + 1 < sizeof(na.id)) {
/* id */
- memcpy(na.id, v, vl);
+ strlcpy(na.id, v, sizeof(na.id));
} else if (al == 3 && a[0] == 'l' && vl + 1 < sizeof(na.lat)) {
/* lat */
if (a[1] == 'a' && a[2] == 't') {
- memcpy(na.lat, v, vl);
+ strlcpy(na.lat, v, sizeof(na.lat));
} else if (a[1] == 'o' && a[2] == 'n') {
/* lon */
- memcpy(na.lon, v, vl);
+ strlcpy(na.lon, v, sizeof(na.lon));
}
}
return;