2026-02-07, 05:13 AM
BUFFER OVERFLOW (most likely cause):
- szDialog2 is declared with only 1024 bytes
- For 50 members, each row can be ~80-100 characters (name, rank, warns, days + tabs)
- 50 × ~100 = 5000+ bytes
- When strcat() appends more than 1024 bytes, a buffer overflow occurs
- This can corrupt memory and the dialog may not show or the server may crash..
Try with this:
- szDialog2 is declared with only 1024 bytes
- For 50 members, each row can be ~80-100 characters (name, rank, warns, days + tabs)
- 50 × ~100 = 5000+ bytes
- When strcat() appends more than 1024 bytes, a buffer overflow occurs
- This can corrupt memory and the dialog may not show or the server may crash..
Try with this:
Code:
case 1: {
// Larger buffer for dialog (50 members × ~100 chars + header)
new szDialog2[5120], Members, name[180], cwarn[180], cdays[180], szRank1[180];
new szDialog[128]; // explicit declaration for each list row
format(query, sizeof(query), "SELECT * FROM `users` WHERE `users`.`Clan` = '%d' ORDER BY `users`.`ClanRank` DESC LIMIT 50", PlayerInfo[playerid][pClan]);
new Cache: result = mysql_query(SQL, query);
strcat(szDialog2, "#. Name\tRank\tClan Warns\tClan Days\n");
for(new i, j = cache_get_row_count(); i != j; ++i)
{
cache_get_field_content(i, "Username", name);
cache_get_field_content(i, "ClanRank", szRank1);
cache_get_field_content(i, "ClanWarns", cwarn);
cache_get_field_content(i, "ClanDays", cdays);
format(Selected[playerid][Members], MAX_PLAYER_NAME, name);
format(szDialog, sizeof(szDialog), "%d. %s\t%d\t%s/3\t%s\n", Members+1, name, strval(szRank1), cwarn, cdays);
strcat(szDialog2, szDialog);
Members++;
}
cache_delete(result);
ShowPlayerDialog(playerid, DIALOG_CLAN_MEMBERS, DIALOG_STYLE_TABLIST_HEADERS, "Clan members", szDialog2, "Ok", "Back");
}
