From: Alexander P. <ale...@us...> - 2008-10-29 08:53:08
|
Build Version : T2.5.0.21248 Firebird 2.5 Alpha 1 (writeBuildNum.sh,v 1.21409 2008/10/29 08:53:00 alexpeshkof ) Update of /cvsroot/firebird/firebird2/src/remote In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15603 Modified Files: Tag: B1_5_Release remote.cpp Log Message: Backported fix for CORE-2055: BOF in fbclient Index: remote.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/remote/remote.cpp,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -b -U3 -r1.15.2.1 -r1.15.2.2 --- remote.cpp 21 Aug 2003 22:35:15 -0000 1.15.2.1 +++ remote.cpp 29 Oct 2008 08:52:59 -0000 1.15.2.2 @@ -688,17 +688,24 @@ case gds_arg_string: p = (TEXT *) * vector; if (status != gds_arg_cstring) - l = strlen(p) + 1; + l = strlen(p); + + ++l; // always reserve room for '\0' + + // Avoid too long strings here + if (l > ATTACH_FAILURE_SPACE / 4) + l = ATTACH_FAILURE_SPACE / 4; /* If there isn't any more room in the buffer, start at the beginning again */ - if (attach_failures_ptr + l > - attach_failures + ATTACH_FAILURE_SPACE) attach_failures_ptr = - attach_failures; + if (attach_failures_ptr + l > attach_failures + ATTACH_FAILURE_SPACE) + attach_failures_ptr = attach_failures; *vector++ = (ISC_STATUS) attach_failures_ptr; + --l; // not copy terminator '\0' - it's missing in gds_arg_cstring while (l--) *attach_failures_ptr++ = *p++; + *attach_failures_ptr = '\0'; break; default: |