forked from github/server
CID 22567: Copy into fixed size buffer (STRING_OVERFLOW)
bsdstring replacements, again
This commit is contained in:
parent
51f66b8da8
commit
b8d7fa5bcc
|
@ -357,6 +357,7 @@ static const char *dracoid_name(const unit * u)
|
||||||
{
|
{
|
||||||
static char name[NAMESIZE + 1]; // FIXME: static return value
|
static char name[NAMESIZE + 1]; // FIXME: static return value
|
||||||
int mid_syllabels;
|
int mid_syllabels;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
/* ignore u */
|
/* ignore u */
|
||||||
u = 0;
|
u = 0;
|
||||||
|
@ -364,14 +365,14 @@ static const char *dracoid_name(const unit * u)
|
||||||
|
|
||||||
mid_syllabels = rng_int() % 4;
|
mid_syllabels = rng_int() % 4;
|
||||||
|
|
||||||
strcpy(name, drac_pre[rng_int() % DRAC_PRE]);
|
sz = strlcpy(name, drac_pre[rng_int() % DRAC_PRE], sizeof(name));
|
||||||
while (mid_syllabels > 0) {
|
while (mid_syllabels > 0) {
|
||||||
mid_syllabels--;
|
mid_syllabels--;
|
||||||
if (rng_int() % 10 < 4)
|
if (rng_int() % 10 < 4)
|
||||||
strcat(name, "'");
|
strlcat(name, "'", sizeof(name));
|
||||||
strcat(name, drac_mid[rng_int() % DRAC_MID]);
|
sz += strlcat(name, drac_mid[rng_int() % DRAC_MID], sizeof(name));
|
||||||
}
|
}
|
||||||
strcat(name, drac_suf[rng_int() % DRAC_SUF]);
|
sz += strlcat(name, drac_suf[rng_int() % DRAC_SUF], sizeof(name));
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue