# HG changeset patch # User smatz # Date 1225713780 0 # Node ID b3c652b3a31689f038daa4d3814106c52266b5c5 # Parent ac0958307f68766a04eaa051addd7615dcbbe21f (svn r14560) -Fix [FS#2396](r14555): lengthof() can't be simply replaced by lastof() in some cases (part by Aali) diff -r ac0958307f68 -r b3c652b3a316 src/network/network_server.cpp --- a/src/network/network_server.cpp Sun Nov 02 19:32:24 2008 +0000 +++ b/src/network/network_server.cpp Mon Nov 03 12:03:00 2008 +0000 @@ -1372,7 +1372,7 @@ ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); // Register local company (if not dedicated) if (ci != NULL && IsValidCompanyID(ci->client_playas)) - strecpy(_network_company_info[ci->client_playas].clients, ci->client_name, lastof(_network_company_info[0].clients)); + strecpy(_network_company_info[ci->client_playas].clients, ci->client_name, lastof(_network_company_info[ci->client_playas].clients)); FOR_ALL_CLIENTS(cs) { char client_name[NETWORK_CLIENT_NAME_LENGTH]; @@ -1382,10 +1382,10 @@ ci = DEREF_CLIENT_INFO(cs); if (ci != NULL && IsValidCompanyID(ci->client_playas)) { if (!StrEmpty(_network_company_info[ci->client_playas].clients)) { - strecat(_network_company_info[ci->client_playas].clients, ", ", lastof(_network_company_info[0].clients)); + strecat(_network_company_info[ci->client_playas].clients, ", ", lastof(_network_company_info[ci->client_playas].clients)); } - strecat(_network_company_info[ci->client_playas].clients, client_name, lastof(_network_company_info[0].clients)); + strecat(_network_company_info[ci->client_playas].clients, client_name, lastof(_network_company_info[ci->client_playas].clients)); } } } diff -r ac0958307f68 -r b3c652b3a316 src/unix.cpp --- a/src/unix.cpp Sun Nov 02 19:32:24 2008 +0000 +++ b/src/unix.cpp Mon Nov 03 12:03:00 2008 +0000 @@ -154,7 +154,7 @@ size_t outlen = sizeof(buf) - 1; size_t inlen = strlen(name); - strecpy(outbuf, name, lastof(buf)); + strecpy(outbuf, name, outbuf + outlen); iconv(convd, NULL, NULL, NULL, NULL); if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {