From 6c9a433ca15f40f268fe26515c9ba1629dc00c3d Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 12 Apr 2007 05:18:53 +0000 Subject: Add a check to make sure initializing the BSS section doesn't pass a negative size to memset. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13116 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/plugin.c b/apps/plugin.c index 276bf1b078..1db0253c4e 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -577,7 +577,8 @@ int plugin_load(const char* plugin, void* parameter) plugin_size = hdr->end_addr - pluginbuf; /* zero out bss area only, above guards end of pluginbuf */ - memset(pluginbuf + readsize, 0, plugin_size - readsize); + if (plugin_size > readsize) + memset(pluginbuf + readsize, 0, plugin_size - readsize); #endif plugin_loaded = true; -- cgit v1.2.3