Author: wyoung
Date: Tue Jun 19 07:11:05 2007
New Revision: 1568

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1568&view=rev
Log:
Fixed a null-termination bug in Query::parse().  If you somehow
constructed a query string without a terminating null character, then
tried to parse it as a template query, it could walk off the end of the
string.  Patch by Worster Chen <[EMAIL PROTECTED]>

Modified:
    trunk/lib/query.cpp

Modified: trunk/lib/query.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1568&r1=1567&r2=1568&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Tue Jun 19 07:11:05 2007
@@ -353,7 +353,8 @@
 {
        const std::string& str(sbuffer_.str());
        char* s = new char[str.size() + 1];
-       memcpy(s, str.data(), str.size() + 1); 
+       memcpy(s, str.data(), str.size()); 
+       s[str.size()] = '\0';
        return s;
 }
 


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to