Juan Lang : msi: Don't crash if record has no fields.
Alexandre Julliard
julliard at winehq.org
Tue Sep 18 05:31:05 CDT 2007
Module: wine
Branch: master
Commit: c2d66da665984e6dbfa462baa935b211c1c8b146
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c2d66da665984e6dbfa462baa935b211c1c8b146
Author: Juan Lang <juan.lang at gmail.com>
Date: Mon Sep 17 08:02:18 2007 -0700
msi: Don't crash if record has no fields.
---
dlls/msi/format.c | 4 ++--
dlls/msi/tests/format.c | 11 +++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/format.c b/dlls/msi/format.c
index 06ef676..73ee056 100644
--- a/dlls/msi/format.c
+++ b/dlls/msi/format.c
@@ -626,8 +626,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
TRACE("(%s)\n",debugstr_w(rec));
- len = deformat_string_internal(package,rec,&deformated,strlenW(rec),
- record, NULL);
+ len = deformat_string_internal(package,rec,&deformated,
+ rec ? strlenW(rec) : 0, record, NULL);
if (buffer)
{
diff --git a/dlls/msi/tests/format.c b/dlls/msi/tests/format.c
index 23438bb..acaa2db 100644
--- a/dlls/msi/tests/format.c
+++ b/dlls/msi/tests/format.c
@@ -388,6 +388,17 @@ static void test_formatrecord(void)
r = MsiFormatRecord(0, 0, NULL, NULL );
ok( r == ERROR_INVALID_HANDLE, "wrong error\n");
+ hrec = MsiCreateRecord(0);
+ ok( hrec, "failed to create record\n");
+
+ /* format an empty record on a record with no parameters */
+ sz = sizeof(buffer);
+ r = MsiFormatRecordA(0, hrec, buffer, &sz );
+ ok( r == ERROR_SUCCESS, "format failed\n");
+ ok( sz == 0, "size wrong\n");
+
+ MsiCloseHandle( hrec );
+
hrec = MsiCreateRecord(4);
ok( hrec, "failed to create record\n");
More information about the wine-cvs
mailing list