mirror of
https://github.com/samba-team/samba.git
synced 2025-09-20 17:44:21 +03:00
s4:torture: Use strlcpy() in gen_name()
../source4/torture/basic/mangle_test.c: In function ‘gen_name’: ../source4/torture/basic/mangle_test.c:148:3: error: ‘strncpy’ output truncated before terminating nul copying 5 bytes from a string of the same length [-Werror=stringop-truncation] strncpy(p, "ABCDE", 5); ^~~~~~~~~~~~~~~~~~~~~~ BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
committed by
Andreas Schneider
parent
7cec343a89
commit
7a00d90d66
@@ -145,7 +145,7 @@ static char *gen_name(TALLOC_CTX *mem_ctx)
|
|||||||
|
|
||||||
/* and a medium probability of a common lead string */
|
/* and a medium probability of a common lead string */
|
||||||
if ((len > 5) && (random() % 10 == 0)) {
|
if ((len > 5) && (random() % 10 == 0)) {
|
||||||
strncpy(p, "ABCDE", 5);
|
strlcpy(p, "ABCDE", 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and a high probability of a good extension length */
|
/* and a high probability of a good extension length */
|
||||||
|
Reference in New Issue
Block a user