Fix of a possible buffer overflow

This commit is contained in:
skyrim 2014-07-30 22:43:26 +02:00
parent 2b1b400e37
commit f1b2c802e6
3 changed files with 6 additions and 6 deletions

View File

@ -198,7 +198,7 @@ public voteNextmap()
if (++a >= g_mapNums) a = 0 if (++a >= g_mapNums) a = 0
g_nextName[g_mapVoteNum] = a g_nextName[g_mapVoteNum] = a
pos += format(menu[pos], charsmax(menu), "%d. %a^n", g_mapVoteNum + 1, ArrayGetStringHandle(g_mapName, a)); pos += format(menu[pos], charsmax(menu) - pos, "%d. %a^n", g_mapVoteNum + 1, ArrayGetStringHandle(g_mapName, a));
mkeys |= (1<<g_mapVoteNum) mkeys |= (1<<g_mapVoteNum)
g_voteCount[g_mapVoteNum] = 0 g_voteCount[g_mapVoteNum] = 0
} }
@ -212,7 +212,7 @@ public voteNextmap()
if ((winlimit + maxrounds) == 0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max"))) if ((winlimit + maxrounds) == 0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))
{ {
pos += format(menu[pos], charsmax(menu), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname) pos += format(menu[pos], charsmax(menu) - pos, "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname)
mkeys |= (1<<SELECTMAPS) mkeys |= (1<<SELECTMAPS)
} }

View File

@ -365,12 +365,12 @@ public actionVoteMapMenu(id, key)
for (new c = 0; c < g_voteSelectedNum[id]; ++c) for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{ {
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap)); ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], charsmax(menuBody), "%d. %s^n", c + 1, tempMap) len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", c + 1, tempMap)
keys |= (1<<c) keys |= (1<<c)
} }
keys |= (1<<8) keys |= (1<<8)
len += format(menuBody[len], charsmax(menuBody), "^n9. %L^n", id, "NONE") len += format(menuBody[len], charsmax(menuBody) - len, "^n9. %L^n", id, "NONE")
} else { } else {
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMap, charsmax(tempMap)); ArrayGetString(g_mapName, g_voteSelected[id][0], tempMap, charsmax(tempMap));
len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO") len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO")

View File

@ -126,7 +126,7 @@ public voteNextmap(){
while( isInMenu(a) ) while( isInMenu(a) )
if (++a >= g_mapNums) a = 0 if (++a >= g_mapNums) a = 0
g_nextName[g_mapVoteNum] = a g_nextName[g_mapVoteNum] = a
pos += format(menu[pos],511,"%d. %s^n",g_mapVoteNum+1,g_mapName[a]) pos += format(menu[pos], charsmax(menu) - pos, "%d. %s^n", g_mapVoteNum + 1, g_mapName[a])
mkeys |= (1<<g_mapVoteNum) mkeys |= (1<<g_mapVoteNum)
g_voteCount[g_mapVoteNum] = 0 g_voteCount[g_mapVoteNum] = 0
} }
@ -137,7 +137,7 @@ public voteNextmap(){
get_mapname(mapname,31) get_mapname(mapname,31)
if ( get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max") ){ if ( get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max") ){
pos += format(menu[pos],511,"%d. Extend map %s^n",SELECTMAPS+1,mapname) pos += format(menu[pos], charsmax(menu) - pos, "%d. Extend map %s^n", SELECTMAPS+1, mapname)
mkeys |= (1<<SELECTMAPS) mkeys |= (1<<SELECTMAPS)
} }