From 2b0a40ab227a5edacec6099fe877a325af4389ba Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 12 Sep 2004 09:55:47 +0000 Subject: [PATCH] Safety-Check, in case region names are too long despite all the checks. --- src/common/gamecode/report.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index b2a334a6d..9954aebdf 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -962,9 +962,12 @@ f_regionid(const region * r, const faction * f) else { pl = getplane(r); if(pl && fval(pl,PFL_NOCOORDS)) { - sprintf(buf, "%s", rname(r, f->locale)); + strncpy(buf, rname(r, f->locale), NAMESIZE); + buf[NAMESIZE]=0; } else { - sprintf(buf, "%s (%d,%d%s%s)", rname(r, f->locale), region_x(r,f), region_y(r,f), pl?",":"", pl?pl->name:""); + strncpy(buf, rname(r, f->locale), NAMESIZE); + buf[NAMESIZE]=0; + sprintf(buf+strlen(buf), " (%d,%d%s%s)", region_x(r,f), region_y(r,f), pl?",":"", pl?pl->name:""); } }