aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-02-02 12:48:38 +0100
committerJoel Bodenmann <joel@unormal.org>2014-02-02 12:48:38 +0100
commit3c99e6e67dfa9833e25ebd417ccbd45a2d4493f6 (patch)
tree667fc783000ca6bef7c57bbfbd961e4e5b2c417e /src/gwin
parent6ff66cd401d759bdbc476f1849edc45b8747f919 (diff)
parentbf8ceb278fc285eff477294e1ae2cf539ada747b (diff)
downloaduGFX-3c99e6e67dfa9833e25ebd417ccbd45a2d4493f6.tar.gz
uGFX-3c99e6e67dfa9833e25ebd417ccbd45a2d4493f6.tar.bz2
uGFX-3c99e6e67dfa9833e25ebd417ccbd45a2d4493f6.zip
Merge branch 'master' into gwin
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/list.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gwin/list.c b/src/gwin/list.c
index 0f09e86e..972ea1ab 100644
--- a/src/gwin/list.c
+++ b/src/gwin/list.c
@@ -431,13 +431,14 @@ int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
ListItem *newItem;
if (useAlloc) {
- if (!(newItem = (ListItem *)gfxAlloc(sizeof(ListItem)+strlen(item_name)+1)))
+ size_t len = strlen(item_name)+1;
+ if (!(newItem = gfxAlloc(sizeof(ListItem) + len)))
return -1;
- strcpy((char *)(newItem+1), item_name);
+ memcpy((char *)(newItem+1), item_name, len);
item_name = (const char *)(newItem+1);
} else {
- if (!(newItem = (ListItem *)gfxAlloc(sizeof(ListItem))))
+ if (!(newItem = gfxAlloc(sizeof(ListItem))))
return -1;
}