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); assert(maxlen < 16 * 1024);
log_warning(("[strcheck] String wurde auf %d Zeichen verkürzt:\n%s\n", log_warning(("[strcheck] String wurde auf %d Zeichen verkürzt:\n%s\n",
(int)maxlen, s)); (int)maxlen, s));
strncpy(buffer, s, maxlen); strnzcpy(buffer, s, maxlen);
buffer[maxlen] = 0;
return buffer; return buffer;
} }
return s; return s;

View File

@ -84,7 +84,7 @@ translate_regions(const char *st, const faction * f)
x = c - p; x = c - p;
s = temp; s = temp;
strncpy(t, p, x); strnzcpy(t, p, x);
t += (c - p); t += (c - p);
p = c + 3; p = c + 3;
koor_x = atoi(p); koor_x = atoi(p);
@ -385,8 +385,7 @@ new_message(struct faction * receiver, const char* sig, ...)
void * args[16]; void * args[16];
memset(args, 0, sizeof(args)); memset(args, 0, sizeof(args));
strncpy(buffer, sig, signature-sig); strnzcpy(buffer, sig, signature-sig);
buffer[signature-sig] = '\0';
mtype = mt_find(buffer); mtype = mt_find(buffer);
if (!mtype) { 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)); res->amount = (int)(modifier * res->base * (1+(res->level-res->startlevel)*res->divisor/100.0));
/* random adjustment, +/- 91% */ /* random adjustment, +/- 91% */
#ifdef RESOURCE_QUANTITY #ifdef RESOURCE_QUANTITY
res->amount = res->amount * RESOURCE_QUANTITY; res->amount = (int)(res->amount * RESOURCE_QUANTITY);
#endif #endif
} }
} }

View File

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