asdfuser pushed a commit to branch master.
commit 8d280ffc3875706ef9c7ff31a88809f5a4fa4dd2
Author: Daniel Willmann <[email protected]>
Date: Mon Mar 18 12:07:23 2013 +0000
toolbar: Use snprintf for elm,number,item buffer handling
Avoid potential buffer overflow
Signed-off-by: Daniel Willmann <[email protected]>
---
src/lib/elm_toolbar.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index b741706..6b58109 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -899,7 +899,7 @@ _inform_item_number(Evas_Object *obj)
{
ELM_TOOLBAR_DATA_GET(obj, sd);
Elm_Toolbar_Item *it;
- char buf[sizeof("elm,action,click,") + 3];
+ char buf[sizeof("elm,number,item,") + 4];
static int scount = 0;
int count = 0;
@@ -910,7 +910,8 @@ _inform_item_number(Evas_Object *obj)
if (scount != count)
{
scount = count;
- sprintf(buf, "elm,number,item,%d", count);
+ if (snprintf(buf, sizeof(buf), "elm,number,item,%d", count) >=
sizeof(buf))
+ ERR("Too many items to fit signal buffer (%d)", count);
EINA_INLIST_FOREACH(sd->items, it)
{
--
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar