diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 33d2f499f4e..09c5c37d012 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -198,6 +198,11 @@ fdesc_lookup(ap) } fd = 0; + /* the only time a leading 0 is acceptable is if it's "0" */ + if (*pname == '0' && nlen != 1) { + error = ENOENT; + goto bad; + } while (nlen--) { if (*pname < '0' || *pname > '9') { error = ENOENT; diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 33d2f499f4e..09c5c37d012 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -198,6 +198,11 @@ fdesc_lookup(ap) } fd = 0; + /* the only time a leading 0 is acceptable is if it's "0" */ + if (*pname == '0' && nlen != 1) { + error = ENOENT; + goto bad; + } while (nlen--) { if (*pname < '0' || *pname > '9') { error = ENOENT;