]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/otp: Replace VLA with `boost::container::small_vector`
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 26 Mar 2026 02:39:32 +0000 (22:39 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Thu, 26 Mar 2026 04:07:21 +0000 (00:07 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/cls/otp/cls_otp.cc

index 4dfca82556bf28269ca86c23265c96443160a313..3e0e8432e1c478faf8e8cdb2d87229d18c781bb5 100644 (file)
@@ -8,21 +8,17 @@
  *
  */
 
-#include <errno.h>
-#include <map>
+#include <cerrno>
 #include <list>
 
 #include <boost/range/adaptor/reversed.hpp>
 
+#include <boost/container/small_vector.hpp>
+
 #include <liboath/oath.h>
 
-#include "include/types.h"
-#include "include/utime.h"
 #include "objclass/objclass.h"
 
-#include "common/errno.h"
-#include "common/Clock.h"
-
 #include "cls/otp/cls_otp_ops.h"
 #include "cls/otp/cls_otp_types.h"
 
@@ -268,8 +264,8 @@ static int write_header(cls_method_context_t hctx, const otp_header& h)
 static int parse_seed(const string& seed, SeedType seed_type, bufferlist *seed_bin)
 {
   size_t slen = seed.length();
-  char secret[seed.length()];
-  char *psecret = secret;
+  boost::container::small_vector<char, 1024> secret(seed.length());
+  char *psecret = secret.data();
   int result;
   bool need_free = false;