diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index 173c32b994..2a19344c7e 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -264,12 +264,12 @@ static void editBoxCallbackFunc(const char* pText, void* ctx) CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "changed",pEditBox); ScriptEvent event(kCommonEvent,(void*)&data); ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName,0,64*sizeof(char)); - strncpy(data.eventName,"ended",64); + memset(data.eventName, 0, sizeof(data.eventName)); + strncpy(data.eventName, "ended", sizeof(data.eventName)); event.data = (void*)&data; ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName,0,64*sizeof(char)); - strncpy(data.eventName,"return",64); + memset(data.eventName, 0, sizeof(data.eventName)); + strncpy(data.eventName, "return", sizeof(data.eventName)); event.data = (void*)&data; ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 2befae216a..ecb9a46a02 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -196,8 +196,8 @@ static const int CC_EDIT_BOX_PADDING = 5; cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox); cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data); cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName,0,64*sizeof(char)); - strncpy(data.eventName,"return",64); + memset(data.eventName, 0, sizeof(data.eventName)); + strncpy(data.eventName, "return", sizeof(data.eventName)); event.data = (void*)&data; cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 3af3c7448f..aa7c2b5905 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -187,8 +187,8 @@ cocos2d::CommonScriptData data(pEditBox->getScriptEditBoxHandler(), "ended",pEditBox); cocos2d::ScriptEvent event(cocos2d::kCommonEvent,(void*)&data); cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); - memset(data.eventName,0,64*sizeof(char)); - strncpy(data.eventName,"return",64); + memset(data.eventName, 0, sizeof(data.eventName)); + strncpy(data.eventName, "return", sizeof(data.eventName)); event.data = (void*)&data; cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event); }