Fix for bug 10252

From: Date: Wed, 11 Apr 2001 18:31:43 +0000
Subject: Fix for bug 10252
Groups: php.dev 
Request: Send a blank email to php-dev+get-51457@lists.php.net to get a copy of this message
Bug report: http://bugs.php.net/?id=10252&edit=1 Could someone look over this patch and tell me whether it is safe? Both attached and inline here. --- php_odbc.c.orig Wed Apr 11 12:23:56 2001 +++ php_odbc.c Wed Apr 11 12:27:23 2001 @@ -1928,6 +1928,8 @@ char dsnbuf[300]; short dsnbuflen; char *ldb = 0; + int ldb_len = 0; + if (strstr((char*)db, ";")) { direct = 1; @@ -1936,8 +1938,9 @@ ldb = (char*)emalloc(strlen(db) + strlen(uid) + strlen(pwd) + 12); sprintf(ldb, "%s;UID=%s;PWD=%s", db, uid, pwd); } else { - ldb = (char*)emalloc(strlen(db) + 1); - strcat(ldb, db); + ldb_len = (strlen(db)+1); + ldb = (char*)emalloc(ldb_len); + strlcpy(ldb, db, ldb_len); } }

« previous php.dev (#51457) next »