This commit is contained in:
Enno Rehling 2002-04-21 10:52:22 +00:00
parent 0960a541ea
commit c133699453
4 changed files with 5 additions and 7 deletions

View File

@ -947,8 +947,7 @@ strcheck (const char *s, size_t maxlen)
assert(maxlen < 16 * 1024);
log_warning(("[strcheck] String wurde auf %d Zeichen verkürzt:\n%s\n",
(int)maxlen, s));
strncpy(buffer, s, maxlen);
buffer[maxlen] = 0;
strnzcpy(buffer, s, maxlen);
return buffer;
}
return s;

View File

@ -84,7 +84,7 @@ translate_regions(const char *st, const faction * f)
x = c - p;
s = temp;
strncpy(t, p, x);
strnzcpy(t, p, x);
t += (c - p);
p = c + 3;
koor_x = atoi(p);
@ -385,8 +385,7 @@ new_message(struct faction * receiver, const char* sig, ...)
void * args[16];
memset(args, 0, sizeof(args));
strncpy(buffer, sig, signature-sig);
buffer[signature-sig] = '\0';
strnzcpy(buffer, sig, signature-sig);
mtype = mt_find(buffer);
if (!mtype) {

View File

@ -131,7 +131,7 @@ static void use_default(rawmaterial *res, const region * r, int amount)
res->amount = (int)(modifier * res->base * (1+(res->level-res->startlevel)*res->divisor/100.0));
/* random adjustment, +/- 91% */
#ifdef RESOURCE_QUANTITY
res->amount = res->amount * RESOURCE_QUANTITY;
res->amount = (int)(res->amount * RESOURCE_QUANTITY);
#endif
}
}

View File

@ -435,7 +435,7 @@ static faction *
factionorders(void)
{
char b[16];
char * fid = strncpy(b, getstrtoken(), 16);
char * fid = strnzcpy(b, getstrtoken(), 16);
char * pass = getstrtoken();
faction *f;