Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2026 22:54:55 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 292528] strlcpy truncates result
Message-ID:  <bug-292528-227-HmM125uyuJ@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-292528-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

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.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-292528-227-HmM125uyuJ>