mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
tests: remove strncpy()
use
`checkpatch` has sufficiently annoyed me to fix this. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
fd6f46e9fd
commit
84fd92c80e
|
@ -49,16 +49,17 @@ const char *prng_fuzz(struct prng *prng, const char *string,
|
|||
const char *charset, unsigned int operations)
|
||||
{
|
||||
static char buf[256];
|
||||
unsigned int charset_len;
|
||||
size_t charset_len = strlen(charset);
|
||||
size_t str_len = strlen(string);
|
||||
unsigned int i;
|
||||
unsigned int offset;
|
||||
unsigned int op;
|
||||
unsigned int character;
|
||||
|
||||
assert(strlen(string) < sizeof(buf));
|
||||
assert(str_len < sizeof(buf));
|
||||
|
||||
strncpy(buf, string, sizeof(buf));
|
||||
charset_len = strlen(charset);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memcpy(buf, string, str_len);
|
||||
|
||||
for (i = 0; i < operations; i++) {
|
||||
offset = prng_rand(prng) % strlen(buf);
|
||||
|
|
|
@ -43,7 +43,7 @@ static char *sortlines(char *in)
|
|||
}
|
||||
|
||||
if (line_count == 1) {
|
||||
strncpy(rv, in, rv_len);
|
||||
memcpy(rv, in, rv_len);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue