From 9347234fbef068a422ab4fc0dc8a07cb4c1a46c7 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 17 Sep 2007 08:02:18 -0700 Subject: [PATCH] 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* pack 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"); -- 1.4.1