forked from github/server
bugfix buffer bounds
This commit is contained in:
parent
5104d7c4ca
commit
c355a5d862
|
@ -235,7 +235,7 @@ alliancename(const alliance * al)
|
||||||
|
|
||||||
if (al && al->name) {
|
if (al && al->name) {
|
||||||
snprintf(ibuf, sizeof(name), "%s (%s)", strcheck(al->name, NAMESIZE), itoa36(al->id));
|
snprintf(ibuf, sizeof(name), "%s (%s)", strcheck(al->name, NAMESIZE), itoa36(al->id));
|
||||||
ibuf[sizeof(name)] = 0;
|
ibuf[sizeof(name)-1] = 0;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1821,7 +1821,7 @@ buildingname (const building * b)
|
||||||
char *ibuf = idbuf[(++nextbuf) % 8];
|
char *ibuf = idbuf[(++nextbuf) % 8];
|
||||||
|
|
||||||
snprintf(ibuf, sizeof(ibuf), "%s (%s)", strcheck(b->name, NAMESIZE), itoa36(b->no));
|
snprintf(ibuf, sizeof(ibuf), "%s (%s)", strcheck(b->name, NAMESIZE), itoa36(b->no));
|
||||||
ibuf[sizeof(name)] = 0;
|
ibuf[sizeof(name)-1] = 0;
|
||||||
return ibuf;
|
return ibuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1853,7 +1853,7 @@ unitname(const unit * u)
|
||||||
{
|
{
|
||||||
char *ubuf = idbuf[(++nextbuf) % 8];
|
char *ubuf = idbuf[(++nextbuf) % 8];
|
||||||
snprintf(ubuf, sizeof(name), "%s (%s)", strcheck(u->name, NAMESIZE), itoa36(u->no));
|
snprintf(ubuf, sizeof(name), "%s (%s)", strcheck(u->name, NAMESIZE), itoa36(u->no));
|
||||||
ubuf[sizeof(name)] = 0;
|
ubuf[sizeof(name)-1] = 0;
|
||||||
return ubuf;
|
return ubuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ factionname(const faction * f)
|
||||||
|
|
||||||
if (f && f->name) {
|
if (f && f->name) {
|
||||||
snprintf(ibuf, sizeof(name), "%s (%s)", strcheck(f->name, NAMESIZE), itoa36(f->no));
|
snprintf(ibuf, sizeof(name), "%s (%s)", strcheck(f->name, NAMESIZE), itoa36(f->no));
|
||||||
ibuf[sizeof(name)] = 0;
|
ibuf[sizeof(name)-1] = 0;
|
||||||
} else {
|
} else {
|
||||||
strcpy(ibuf, "Unbekannte Partei (?)");
|
strcpy(ibuf, "Unbekannte Partei (?)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -878,7 +878,7 @@ is_guarded(region * r, unit * u, unsigned int mask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (is_guardian(u2, u, mask)) {
|
if (u2!=guardcache && is_guardian(u2, u, mask)) {
|
||||||
guardcache = u2;
|
guardcache = u2;
|
||||||
return u2;
|
return u2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1054,7 +1054,6 @@ readunit(FILE * F)
|
||||||
u->flags = ri(F) & ~UFL_DEBUG;
|
u->flags = ri(F) & ~UFL_DEBUG;
|
||||||
u->flags &= UFL_SAVEMASK;
|
u->flags &= UFL_SAVEMASK;
|
||||||
}
|
}
|
||||||
if (u->flags&UFL_GUARD) fset(u->region, UFL_GUARD);
|
|
||||||
/* Persistente Befehle einlesen */
|
/* Persistente Befehle einlesen */
|
||||||
free_orders(&u->orders);
|
free_orders(&u->orders);
|
||||||
freadstr(F, buf, sizeof(buf));
|
freadstr(F, buf, sizeof(buf));
|
||||||
|
@ -1917,6 +1916,7 @@ readgame(const char * filename, int backup)
|
||||||
|
|
||||||
assert(u->region==NULL);
|
assert(u->region==NULL);
|
||||||
u->region = r;
|
u->region = r;
|
||||||
|
if (u->flags&UFL_GUARD) fset(r, RF_GUARDED);
|
||||||
*up = u;
|
*up = u;
|
||||||
up = &u->next;
|
up = &u->next;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue