- string overlaps

This commit is contained in:
Christian Schlittchen 2004-01-04 11:28:26 +00:00
parent 797f3f244f
commit 342629298b
3 changed files with 10 additions and 4 deletions

View File

@ -159,6 +159,7 @@ scramble(void *data, int n, size_t width)
char * src = ((char*)data)+width*i;
int k = i;
int dest = vec[k].index;
if (temp==NULL) {
temp = malloc(width);
}
@ -166,7 +167,7 @@ scramble(void *data, int n, size_t width)
do {
char * target = ((char*)data)+width*dest;
memcpy(buffer, target, width);
memcpy(target, src, width);
memmove(target, src, width);
k = dest; /* wo das gerettete target hin soll */
dest = vec[dest].index;
vec[k].index = k; /* dest ist an der richtigen stelle */

View File

@ -1188,7 +1188,7 @@ quit(void)
puts(" - beseitige Spieler, die sich nach der Anmeldung nicht "
"gemeldet haben...");
age = calloc(turn+1, sizeof(int));
age = calloc(max(4,turn+1), sizeof(int));
for (f = factions; f; f = f->next) if (f->no != MONSTER_FACTION) {
if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
if (f->age>=0 && f->age <= turn) ++age[f->age];

View File

@ -407,8 +407,13 @@ rps(FILE * F, const char * src)
{
char * s;
if (strstr(src, "\\r(")) s = replace_global_coords(src, current_faction);
else s = strcpy(buf, src);
if (strstr(src, "\\r(")) {
s = replace_global_coords(src, current_faction);
} else if(src != buf) {
s = strcpy(buf, src);
} else {
s = src;
}
rpsnr(F, s, 0);
}