X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCSwitch.cpp;h=f4de9cb56e204f66ef1b01bf14f2d884dd5ac2f7;hb=cf2524c90dbc915f8a7f41a6ae7f9c84b3f6b0e7;hp=ae39a2a02a909ecb2ca3e8926905e55f14d8e642;hpb=6d93c744add4c06b85cf6c6d7e6317536a5c8ec1;p=quix0rs-blobwars.git diff --git a/src/CSwitch.cpp b/src/CSwitch.cpp old mode 100755 new mode 100644 index ae39a2a..f4de9cb --- a/src/CSwitch.cpp +++ b/src/CSwitch.cpp @@ -1,5 +1,6 @@ /* -Copyright (C) 2004 Parallel Realities +Copyright (C) 2004-2011 Parallel Realities +Copyright (C) 2011-2015 Perpendicular Dimensions This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -22,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Switch::Switch() { - strcpy(this->name, ""); - strcpy(this->linkName, ""); - strcpy(this->requiredObjectName, ""); - strcpy(this->activateMessage, ""); + this->name[0] = 0; + this->linkName[0] = 0; + this->requiredObjectName[0] = 0; + this->activateMessage[0] = 0; type = 0; x = y = 0; @@ -37,10 +38,10 @@ Switch::Switch() void Switch::set(const char *name, const char *linkName, const char *requiredObjectName, const char *activateMessage, int type, int x, int y, bool activated) { - strcpy(this->name, name); - strcpy(this->linkName, linkName); - strcpy(this->requiredObjectName, requiredObjectName); - strcpy(this->activateMessage, activateMessage); + strlcpy(this->name, name, sizeof this->name); + strlcpy(this->linkName, linkName, sizeof this->linkName); + strlcpy(this->requiredObjectName, requiredObjectName, sizeof this->requiredObjectName); + strlcpy(this->activateMessage, activateMessage, sizeof this->activateMessage); this->type = type; this->x = x; this->y = y;