[Bug 292528] strlcpy truncates result
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 292528] strlcpy truncates result"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 16 Jan 2026 22:54:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292528
Dave Baukus <daveb@spectralogic.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|Affects Only Me |Affects Some People
--- Comment #1 from Dave Baukus <daveb@spectralogic.com> ---
I've decomposed some broken samba vfs_freebsd.c acl code down to the following
simple test of strlcpy(3); this test works on older freeBSD13 but not on my
FreeBSD14.3
#include <stdio.h>
#include <string.h>
void
listX(char *list, size_t size)
{
char *p, *q;
int len;
p = list;
q = list;
len = p[0] + 1;
printf("copy len = %d\n", len);
printf("list data = %s\n", &p[1]);
(void)strlcpy(q, p + 1, len);
printf("list after copy q = %s, list = %s\n", q, list);
}
int
main()
{
char data[32] = "\005NTACL";
char *p = data;
int len;
len = p[0];
printf("len = %d\n", len);
listX(data, sizeof(data));
return 0;
}
Correct output on 13.1-STABLE:
len = 5
copy len = 6
list data = NTACL
list after copy q = NTACL, list = NTACL
Incorrect output on 14.3-STABLE (note truncated 'L'):
len = 5
list len = 6
list data = NTACL
list after copy q = NTAC, list = NTAC
The I derived the above code from my broken Samba 4.22.6;
--
You are receiving this mail because:
You are the assignee for the bug.