From: Christopher Hoffman Date: Fri, 28 Mar 2025 13:28:40 +0000 (+0000) Subject: client: Check for dname max len before wrapping name X-Git-Tag: testing/wip-vshankar-testing-20260120.085915-debug^2~13^2~62 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=511212a75ff590098e282cfb11e1ce1d8791ec97;p=ceph-ci.git client: Check for dname max len before wrapping name Signed-off-by: Christopher Hoffman --- diff --git a/src/client/Client.cc b/src/client/Client.cc index e022dba9644..b2c1c165887 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7888,6 +7888,11 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, caps = CEPH_CAP_AUTH_SHARED; } + if (dname.size() > NAME_MAX) { + rc = -ENAMETOOLONG; + goto out; + } + // N.B.: we don't validate alternate_name we generate during wrapping // matches the dentry. We probably should! if (!_wrap_name(*diri, dname, alternate_name)) { @@ -7895,11 +7900,6 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, goto out; } - if (dname.size() > NAME_MAX) { - rc = -ENAMETOOLONG; - goto out; - } - dn = get_or_create(diri.get(), dname.c_str()); /* Get extra requested caps on the last component */