[postgis-tickets] r15480 - Fix buffer overflow and use of uninitialized value
Sandro Santilli
strk at kbt.io
Mon Jul 10 10:29:03 PDT 2017
Author: strk
Date: 2017-07-10 10:29:03 -0700 (Mon, 10 Jul 2017)
New Revision: 15480
Modified:
trunk/loader/pgsql2shp-core.c
Log:
Fix buffer overflow and use of uninitialized value
See #3101 (for trunk)
Modified: trunk/loader/pgsql2shp-core.c
===================================================================
--- trunk/loader/pgsql2shp-core.c 2017-07-09 14:35:20 UTC (rev 15479)
+++ trunk/loader/pgsql2shp-core.c 2017-07-10 17:29:03 UTC (rev 15480)
@@ -1167,6 +1167,7 @@
state->dbffieldtypes = NULL;
state->pgfieldnames = NULL;
state->big_endian = is_bigendian();
+ state->message[0] = '\0';
colmap_init(&state->column_map);
return state;
@@ -1557,9 +1558,9 @@
/* Issue warning if column has been renamed */
if (strcasecmp(dbffieldname, pgfieldname))
{
+ snprintf(buf, 256, _("Warning, field %s renamed to %s\n"), pgfieldname, dbffieldname);
/* Note: we concatenate all warnings from the main loop as this is useful information */
- snprintf(buf, 256, _("Warning, field %s renamed to %s\n"), pgfieldname, dbffieldname);
- strncat(state->message, buf, SHPDUMPERMSGLEN - strlen(state->message));
+ strncat(state->message, buf, SHPDUMPERMSGLEN - strlen(state->message) - 1);
ret = SHPDUMPERWARN;
}
More information about the postgis-tickets
mailing list