PHP 4.0 Bug #10252: strcat() used on uninitialized string
| From: | dzoll at nyscul dot org | Date: | Mon, 09 Apr 2001 19:30:56 +0000 |
| Subject: | PHP 4.0 Bug #10252: strcat() used on uninitialized string | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51230@lists.php.net to get a copy of this message | ||
From: dzoll@nyscul.org
Operating system: linux
PHP version: 4.0.4pl1
PHP Bug Type: ODBC related
Bug description: strcat() used on uninitialized string
I was getting intermittent errors connecting to databases.
Sometimes it would work fine, sometimes my connect string
would turn to gibberish and sometimes the process would
segfault.
On further examination, in
ext/odbc/php_odbc.c:odbc_sqlconnect(), within the
if(strstr(char *)db,";") block, there is a line
"strcat(ldb,db);". At this point in the code, ldb was just
emalloced, and had uninitialized contents. I think strcpy()
is more appopriate here, and changing the code to this seems
to have cleared up my errors.
Thank you very much.
--
Edit Bug report at: http://bugs.php.net/?id=10252&edit=1