]> granicus.if.org Git - postgis/commitdiff
Fix buffer overrun case.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 15 Dec 2009 18:42:57 +0000 (18:42 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 15 Dec 2009 18:42:57 +0000 (18:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5003 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-core.c

index 8e2e7be643f42fb81b716b589831ad77a5438372..6c7463113fde7a5f0c444d93ef37c24ea170c6eb 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "shp2pgsql-core.h"
 
-
 /* Internal ring/point structures */
 typedef struct struct_point
 {
@@ -1178,7 +1177,7 @@ ShpLoaderOpenShape(SHPLOADERSTATE *state)
                        ! strcmp(name, "cmin") || ! strcmp(name, "primary") ||
                        ! strcmp(name, "oid") || ! strcmp(name, "ctid"))
                {
-                       strncpy(name2 + 2, name, MAXFIELDNAMELEN);
+                       strncpy(name2 + 2, name, MAXFIELDNAMELEN - 2);
                        name2[0] = '_';
                        name2[1] = '_';
                        strcpy(name, name2);