[PATCH] fs: fat: Prevent possible buffer overflow

Martin Husemann martin at NetBSD.org
Thu Jul 17 16:58:59 CEST 2025


On Thu, Jul 17, 2025 at 03:54:37PM +0100, Andrew Goodbody wrote:
>  
>  	memset(dent, 0, sizeof(*dent));
> -	strcpy(dent->name, dir->itr.name);
> +	strlcpy(dent->name, dir->itr.name, FS_DIRENT_NAME_LEN);

Shouldn't that be strncpy() instead? Using strlcpy() for fixed size
records where strings may not be \0 terminated is quirky.

Martin


More information about the U-Boot mailing list