[postgis-devel] Slight bug in shp2pgsql

Gino Lucrezi gino-postgisdevel at lucrezi.net
Thu Apr 14 06:03:43 PDT 2005


> Thanks Gino, I've applied the patch.
> BTW, latest revision did not have the bug in the second (escaping)
> loop, but just in the first scan (counting occurrences).

I had noticed (that's why I didn't fix the second loop)

This is the reason it fixed a quote in the first character if there was another quote later on. However, in that case, the value of toescape would have been wrong and the allocated buffer would have been shorter by one byte. The second loop would still have written the complete string, overrunning the end of the buffer by one byte.

I'm quite sure this wouldn't corrupt anything most of the time, but why run risks? ;-)


Gino Lucrezi
Penta Consulting Services Srl




More information about the postgis-devel mailing list