]> Cypherpunks repositories - keks.git/commitdiff
Fix pki/cer.c workability
authorSergey Matveev <stargrave@stargrave.org>
Fri, 10 Jan 2025 13:26:00 +0000 (16:26 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 10 Jan 2025 13:26:00 +0000 (16:26 +0300)
c/lib/pki/cer.c

index b4fe5325b6fe7e82d0bdeb0e5559f543dc206addeab9023dbfc32b22d45c7cc0..81eb105108149b082b085e40bcc90ff3ddbb72654760d9b47213dd8c6483410d 100644 (file)
@@ -18,8 +18,11 @@ KEKSCerParse(
     const size_t len)
 {
     struct KEKSItems *items = &(cer->items);
-    KEKSItemsInit(items);
-    enum KEKSErr err = KEKSItemsParse(items, off, buf, len);
+    enum KEKSErr err = KEKSItemsInit(items, 64);
+    if (err != KEKSErrNo) {
+        return err;
+    }
+    err = KEKSItemsParse(items, off, buf, len);
     if (err != KEKSErrNo) {
         return err;
     }
@@ -87,7 +90,8 @@ KEKSCerParse(
                 return KEKSErrUnsatisfiedSchema;
             }
             {
-                size_t pkidIdx = KEKSItemsGetByKeyAndType(items, idx, "id", KEKSItemUUID);
+                size_t pkidIdx =
+                    KEKSItemsGetByKeyAndType(items, idx, "id", KEKSItemUUID);
                 if (pkidIdx == 0) {
                     (*failReason) = "no /load/v/pub/id";
                     return KEKSErrUnsatisfiedSchema;