Index: head/sys/dev/ofw/ofw_fdt.c =================================================================== --- head/sys/dev/ofw/ofw_fdt.c +++ head/sys/dev/ofw/ofw_fdt.c @@ -279,8 +279,6 @@ /* Emulate the 'name' property */ name = fdt_get_name(fdtp, offset, &len); strncpy(buf, name, buflen); - if (len + 1 > buflen) - len = buflen; return (len + 1); } @@ -299,9 +297,8 @@ if (prop == NULL) return (-1); - if (len > buflen) - len = buflen; - bcopy(prop, buf, len); + bcopy(prop, buf, min(len, buflen)); + return (len); }