Author: turnstep
Date: Sun Jan  6 10:43:20 2008
New Revision: 10479

Modified:
   DBD-Pg/trunk/dbdimp.c

Log:
Fix corner-case causing core dump on queries with placeholders with no space 
between them. Thanks to Daniel Browning for spotting this. Ideally, we should 
catch this earlier, but at least DBD::Pg will now produce an error rather than 
crashing.


Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c       (original)
+++ DBD-Pg/trunk/dbdimp.c       Sun Jan  6 10:43:20 2008
@@ -1894,7 +1894,8 @@
        }
        /* Construct the statement, with proper placeholders */
        for (currseg=imp_sth->seg; NULL != currseg; currseg=currseg->nextseg) {
-               strcat(statement, currseg->segment);
+               if (currseg->segment != NULL)
+                       strcat(statement, currseg->segment);
                if (currseg->placeholder) {
                        sprintf(strchr(statement, '\0'), "$%d", 
currseg->placeholder);
                }

Reply via email to