diff options
| author | Stefan Esser <sesser@php.net> | 2002-12-10 15:18:01 +0000 | 
|---|---|---|
| committer | Stefan Esser <sesser@php.net> | 2002-12-10 15:18:01 +0000 | 
| commit | f481a209b74c5bc58b75d7734e9ec489c81b1622 (patch) | |
| tree | b955b97ffc020b61745b825e7427f889b6a9b018 /ext | |
| parent | 26c5c323ab38667b002761395b4d8f33ca1b38bc (diff) | |
| download | php-git-f481a209b74c5bc58b75d7734e9ec489c81b1622.tar.gz | |
fixing crashbug
patch by freddy77@angelfire.com
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/sybase/php_sybase_db.c | 10 | 
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c index aef81e29f5..d7c908cdfa 100644 --- a/ext/sybase/php_sybase_db.c +++ b/ext/sybase/php_sybase_db.c @@ -720,11 +720,14 @@ static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pva  			if (dbwillconvert(coltype(offset),SYBCHAR)) {  				char *res_buf;  				int res_length = dbdatlen(sybase_ptr->link,offset); +				int src_length = res_length;  				register char *p;  				switch (coltype(offset)) {  					case SYBBINARY:  					case SYBVARBINARY: +						res_length *= 2; +						break;  					case SYBCHAR:  					case SYBVARCHAR:  					case SYBTEXT: @@ -740,15 +743,16 @@ static void php_sybase_get_column_content(sybase_link *sybase_ptr,int offset,pva  				memset(res_buf,' ',res_length+1);  /* XXX i'm sure there's a better way  													  but i don't have sybase here to test  													  991105 thies@thieso.net  */ -				dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset), res_length,SYBCHAR,res_buf,-1); +				dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset), res_length,SYBCHAR,res_buf,res_length);  				/* get rid of trailing spaces */  				p = res_buf + res_length; -				while (*p == ' ') { +				while (p >= res_buf && *p == ' ') {  					p--; -					res_length--;  				}  				*(++p) = 0; /* put a trailing NULL */ +				res_length = p - res_buf; +				  				Z_STRLEN_P(result) = res_length;  				Z_STRVAL_P(result) = res_buf;  | 
