summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-12-01 16:08:00 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-12-01 16:08:00 +0000
commit0057f27e69a9e72ca8f261629ef5613dbc0e1b2f (patch)
treea37e00c084203071b6b985aae42650c8271b9d75
parentf217799605242ff92493937b6c2c5dee0b83df7e (diff)
downloadATCD-0057f27e69a9e72ca8f261629ef5613dbc0e1b2f.tar.gz
ChangeLogTag: Wed Dec 1 16:30:00 UTC 2004 Simon Massey <sma@prismtech.com>
-rw-r--r--TAO/ChangeLog7
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp28
2 files changed, 25 insertions, 10 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index c6412ea3033..b44cd9dcccc 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,10 @@
+Wed Dec 1 16:30:00 UTC 2004 Simon Massey <sma@prismtech.com>
+
+ * TAO/TAO_IDL/util/utl_global.cpp
+
+ Fixed bugzilla 1995 - TAO_IDL Compiler - Memory buffer
+ overflow & File handle resource leak
+
Wed Dec 1 15:30:00 UTC 2004 Simon Massey <sma@prismtech.com>
* TAO/orbsvcs/orbsvcs/IFRService/AliasDef_i.cpp
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 21998af7308..ceaac6a61ea 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -89,7 +89,7 @@ ACE_RCSID (util,
#undef INCREMENT
#define INCREMENT 64
-static long seen_once[INCREMENT] = {0};
+static long *pSeenOnce= 0;
IDL_GlobalData::dsf::dsf (void)
: interface_seen_ (0),
@@ -570,7 +570,7 @@ IDL_GlobalData::seen_include_file_before (char *n)
if (ACE_OS::strcmp (tmp, incl) == 0)
{
- return seen_once[i]++;
+ return ++pSeenOnce[i];
}
}
@@ -581,13 +581,11 @@ IDL_GlobalData::seen_include_file_before (char *n)
void
IDL_GlobalData::store_include_file_name (UTL_String *n)
{
- UTL_String **o_include_file_names;
- unsigned long o_n_alloced_file_names;
- unsigned long i;
-
// Check if we need to store it at all or whether we've seen it already.
if (this->seen_include_file_before (n->get_string ()))
{
+ n->destroy ();
+ delete n; // Don't keep filenames we don't store!
return;
}
@@ -600,26 +598,32 @@ IDL_GlobalData::store_include_file_name (UTL_String *n)
this->pd_n_alloced_file_names = INCREMENT;
ACE_NEW (this->pd_include_file_names,
UTL_String *[this->pd_n_alloced_file_names]);
+ ACE_NEW (pSeenOnce, long [this->pd_n_alloced_file_names]);
}
else
{
- o_include_file_names = this->pd_include_file_names;
- o_n_alloced_file_names = this->pd_n_alloced_file_names;
+ UTL_String **o_include_file_names= this->pd_include_file_names;
+ unsigned long o_n_alloced_file_names= this->pd_n_alloced_file_names;
+ long *o_pSeenOnce= pSeenOnce;
+
this->pd_n_alloced_file_names += INCREMENT;
ACE_NEW (this->pd_include_file_names,
UTL_String *[this->pd_n_alloced_file_names]);
+ ACE_NEW (pSeenOnce, long [this->pd_n_alloced_file_names]);
- for (i = 0; i < o_n_alloced_file_names; ++i)
+ for (unsigned long i = 0; i < o_n_alloced_file_names; ++i)
{
this->pd_include_file_names[i] = o_include_file_names[i];
+ pSeenOnce[i]= o_pSeenOnce[i];
}
delete [] o_include_file_names;
+ delete [] o_pSeenOnce;
}
}
// Store it.
- seen_once[this->pd_n_include_file_names] = 1;
+ pSeenOnce[this->pd_n_include_file_names] = 1;
this->pd_include_file_names[this->pd_n_include_file_names++] = n;
}
@@ -763,6 +767,8 @@ IDL_GlobalData::validate_included_idl_files (void)
continue;
}
+ ACE_OS::fclose (test);
+
// This file name is valid.
valid_file = 1;
++n_found;
@@ -802,6 +808,8 @@ IDL_GlobalData::validate_included_idl_files (void)
continue;
}
+ ACE_OS::fclose (test);
+
// This file name is valid.
valid_file = 1;
++n_found;