cvs: php4 /ext/com COM.c
| From: | Alan Brown | Date: | Thu, 18 Apr 2002 01:56:29 +0000 |
| Subject: | cvs: php4 /ext/com COM.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-11187@lists.php.net to get a copy of this message | ||
abrown Wed Apr 17 21:56:29 2002 EDT
Modified files:
/php4/ext/com COM.c
Log:
Missing break; causes fallthrough which actually causes heap corruption in the debugging version
despite being just plain wrong. Also placed a default "Unavailable" message when the
object does not populate the EXCEPINFO structure. Also removed a minor memory leak.
Index: php4/ext/com/COM.c
diff -u php4/ext/com/COM.c:1.65 php4/ext/com/COM.c:1.66
--- php4/ext/com/COM.c:1.65 Fri Mar 15 15:48:25 2002
+++ php4/ext/com/COM.c Wed Apr 17 21:56:28 2002
@@ -133,18 +133,21 @@
if (FAILED(hr)) {
switch (hr) {
case DISP_E_EXCEPTION: {
- int srclen=0;
- char *src=estrdup("");
- int desclen=0;
- char *desc=estrdup("");
+
+ char *src=estrdup("Unavailable");
+ int srclen=strlen(src);
+ char *desc=estrdup("Unavailable");
+ int desclen=strlen(desc);
if (ExceptInfo.bstrSource)
{
+ efree(src);
src = php_OLECHAR_to_char(ExceptInfo.bstrSource, &srclen, codepage TSRMLS_CC);
SysFreeString(ExceptInfo.bstrSource);
}
if (ExceptInfo.bstrDescription)
{
+ efree(desc);
desc = php_OLECHAR_to_char(ExceptInfo.bstrDescription, &desclen, codepage TSRMLS_CC);
SysFreeString(ExceptInfo.bstrDescription);
}
@@ -159,6 +162,7 @@
SysFreeString(ExceptInfo.bstrHelpFile);
}
}
+ break;
case DISP_E_PARAMNOTFOUND:
case DISP_E_TYPEMISMATCH:
*ErrString = pemalloc(25, 1);