Merge pull request #91 from skyrim/bug/possible-buffer-overflow

Fix of a possible buffer overflow
This commit is contained in:
Vincent Herbet 2014-07-31 08:27:43 +02:00
commit c255191a2a
3 changed files with 6 additions and 6 deletions

View File

@ -198,7 +198,7 @@ public voteNextmap()
if (++a >= g_mapNums) a = 0
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)
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")))
{
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)
}

View File

@ -365,12 +365,12 @@ public actionVoteMapMenu(id, key)
for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{
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<<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 {
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")

View File

@ -126,7 +126,7 @@ public voteNextmap(){
while( isInMenu(a) )
if (++a >= g_mapNums) a = 0
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)
g_voteCount[g_mapVoteNum] = 0
}
@ -137,7 +137,7 @@ public voteNextmap(){
get_mapname(mapname,31)
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)
}