On Fri, Jul 19, 2019 at 01:07:34PM +0200, Jan Klemkow wrote:
> Hi,
>
> fixstring() can return NULL and it does on one of my machines.
> Here is s fix that checks for NULL and return an empty string.
>
> ok?
If it returns NULL shouldn't the strlcpy and printf both be skipped?
You've also not included the i386 portion of this.
>
> bye,
> Jan
>
> Index: arch/amd64/amd64/bios.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/bios.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 bios.c
> --- arch/amd64/amd64/bios.c 15 Jul 2019 00:35:10 -0000 1.38
> +++ arch/amd64/amd64/bios.c 19 Jul 2019 08:56:27 -0000
> @@ -144,7 +144,9 @@ bios_attach(struct device *parent, struc
> fixstring(scratch));
> if ((smbios_get_string(&bios, sb->release,
> scratch, sizeof(scratch))) != NULL) {
> - strlcpy(smbios_bios_date, fixstring(scratch),
> + strlcpy(smbios_bios_date,
> + fixstring(scratch) == NULL ? "" :
> + fixstring(scratch),
> sizeof(smbios_bios_date));
> printf(" date %s", fixstring(scratch));
> }
>