mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-06 05:20:33 +00: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)
|
const char *charset, unsigned int operations)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
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 i;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
unsigned int op;
|
unsigned int op;
|
||||||
unsigned int character;
|
unsigned int character;
|
||||||
|
|
||||||
assert(strlen(string) < sizeof(buf));
|
assert(str_len < sizeof(buf));
|
||||||
|
|
||||||
strncpy(buf, string, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
charset_len = strlen(charset);
|
memcpy(buf, string, str_len);
|
||||||
|
|
||||||
for (i = 0; i < operations; i++) {
|
for (i = 0; i < operations; i++) {
|
||||||
offset = prng_rand(prng) % strlen(buf);
|
offset = prng_rand(prng) % strlen(buf);
|
||||||
|
@ -43,7 +43,7 @@ static char *sortlines(char *in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (line_count == 1) {
|
if (line_count == 1) {
|
||||||
strncpy(rv, in, rv_len);
|
memcpy(rv, in, rv_len);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user