]> granicus.if.org Git - php/commitdiff
MFH: Fix for #28512. Allocate enough space to store data
authorFrank M. Kromann <fmk@php.net>
Wed, 30 Jun 2004 19:47:18 +0000 (19:47 +0000)
committerFrank M. Kromann <fmk@php.net>
Wed, 30 Jun 2004 19:47:18 +0000 (19:47 +0000)
ext/mssql/php_mssql.c

index ecbe1edabbf6b2e0a5d0c372f9ba7da35da610ad..7e9d28f8fed4c9d709925ff85d528e06e23ac399 100644 (file)
@@ -847,8 +847,21 @@ static void php_mssql_get_column_content_with_type(mssql_link *mssql_ptr,int off
 
                                if ((column_type != SQLDATETIME && column_type != SQLDATETIM4) || MS_SQL_G(datetimeconvert)) {
 
-                                       if (column_type == SQLDATETIM4) res_length += 14;
-                                       if (column_type == SQLDATETIME) res_length += 10;
+                                       switch (column_type) {
+                                               case SQLDATETIM4 :
+                                                       res_length += 14;
+                                                       break;
+                                               case SQLDATETIME :
+                                                       res_length += 10;
+                                                       break;
+                                               case SQLMONEY :
+                                               case SQLMONEY4 :
+                                               case SQLMONEYN :
+                                               case SQLDECIMAL :
+                                               case SQLNUMERIC :
+                                                       res_length += 5;
+                                                       break;
+                                       }
                        
                                        res_buf = (unsigned char *) emalloc(res_length+1);
                                        res_length = dbconvert(NULL,coltype(offset),dbdata(mssql_ptr->link,offset), res_length, SQLCHAR,res_buf,-1);
@@ -917,6 +930,8 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int
                                case SQLMONEY :
                                case SQLMONEY4 :
                                case SQLMONEYN :
+                               case SQLDECIMAL :
+                               case SQLNUMERIC :
                                        res_length += 5;
                                        break;
                        }