From d975fd045237f073d998c5bedf93efab6b4495b7 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 29 Nov 2018 11:07:46 +0100 Subject: [PATCH] Fixed zero sized allocation. --- libfreerdp/cache/glyph.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libfreerdp/cache/glyph.c b/libfreerdp/cache/glyph.c index f1fcd1ff9..09c8149bd 100644 --- a/libfreerdp/cache/glyph.c +++ b/libfreerdp/cache/glyph.c @@ -796,6 +796,9 @@ CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH if (glyph->unicodeCharacters) { + if (glyph->cGlyphs == 0) + goto fail; + dst->unicodeCharacters = calloc(glyph->cGlyphs, sizeof(WCHAR)); if (!dst->unicodeCharacters) @@ -855,6 +858,9 @@ CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context, if (glyph->unicodeCharacters) { + if (glyph->cGlyphs == 0) + goto fail; + dst->unicodeCharacters = calloc(glyph->cGlyphs, sizeof(WCHAR)); if (!dst->unicodeCharacters)