diff --git a/sys/bus/isa/pnp.c b/sys/bus/isa/pnp.c --- a/sys/bus/isa/pnp.c +++ b/sys/bus/isa/pnp.c @@ -398,12 +398,14 @@ if (PNP_LRES_NUM(tag) == PNP_TAG_ID_ANSI) { if (large_len > sizeof(buf) - 1) large_len = sizeof(buf) - 1; + if (large_len == 0) + continue; bcopy(resinfo, buf, large_len); /* * Trim trailing spaces. */ - while (buf[large_len-1] == ' ') + while (large_len > 0 && buf[large_len-1] == ' ') large_len--; buf[large_len] = '\0'; desc = buf;