Fixed another potential overrun in the Discord support code.

This commit is contained in:
OBattler
2020-01-15 02:24:12 +01:00
parent bb3c5a6f52
commit f3317c9d95

View File

@@ -92,11 +92,16 @@ discord_update_activity(int paused)
else
{
temp = strchr(machine_getname(), ']') + 2;
if (strlen(temp) <= 127)
strcpy(activity.details, temp);
else
strncpy(activity.details, temp, 127);
strcpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name);
if (strlen(machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name) <= 127)
strcpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name);
else
strncpy(activity.state, machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].name, 127);
}
activity.timestamps.start = time(NULL);