]> granicus.if.org Git - postgis/commitdiff
Prevent people from inserting entries in spatial_ref_sys with no proj4text (#1150)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 24 Jan 2012 00:09:53 +0000 (00:09 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 24 Jan 2012 00:09:53 +0000 (00:09 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8910 b70326c6-7e19-0410-871a-916f4a2858ee

libpgcommon/lwgeom_transform.c

index e6a17ad5ddb1e6a1585914c41e62f9a986c5ed69..35b22afe7cc6b253a61fd5b71b3d5be8c409aae8 100644 (file)
@@ -368,9 +368,17 @@ char* GetProj4StringSPI(int srid)
                TupleDesc tupdesc = SPI_tuptable->tupdesc;
                SPITupleTable *tuptable = SPI_tuptable;
                HeapTuple tuple = tuptable->vals[0];
-
-               /* Make a projection object out of it */
-               strncpy(proj_str, SPI_getvalue(tuple, tupdesc, 1), maxproj4len - 1);
+               char *proj4text = SPI_getvalue(tuple, tupdesc, 1);
+               
+               if ( proj4text )
+               {
+                       /* Make a projection object out of it */
+                       strncpy(proj_str, proj4text, maxproj4len - 1);
+               }
+               else
+               {
+                       proj_str[0] = '\0';
+               }
        }
        else
        {