From 2ef572b8fef32cd2a2201b4be563270858ae1b24 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 19 Jun 2011 13:58:42 +0200 Subject: [PATCH] ReaderImplBase::ParseStrings(): Avoid new[0] --- src/kits/package/hpkg/ReaderImplBase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/kits/package/hpkg/ReaderImplBase.cpp b/src/kits/package/hpkg/ReaderImplBase.cpp index d7cb3e95af..c10b5e0fda 100644 --- a/src/kits/package/hpkg/ReaderImplBase.cpp +++ b/src/kits/package/hpkg/ReaderImplBase.cpp @@ -569,7 +569,12 @@ ReaderImplBase::CheckCompression(const SectionInfo& section) const status_t ReaderImplBase::ParseStrings() { - // allocate table + // allocate table, if there are any strings + if (fCurrentSection->stringsCount == 0) { + fCurrentSection->currentOffset += fCurrentSection->stringsLength; + return B_OK; + } + fCurrentSection->strings = new(std::nothrow) char*[fCurrentSection->stringsCount]; if (fCurrentSection->strings == NULL) {