]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Check for dname max len before wrapping name
authorChristopher Hoffman <choffman@redhat.com>
Fri, 28 Mar 2025 13:28:40 +0000 (13:28 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Wed, 5 Nov 2025 13:59:35 +0000 (13:59 +0000)
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/client/Client.cc

index e022dba96440a5cee463b584db765007b71868cd..b2c1c1658873ab1aaa91c8df8dc90b2d1a592fda 100644 (file)
@@ -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 */