| 46 | } |
| 47 | |
| 48 | static char *cni_root(cni_context *c, const char *root) { |
| 49 | size_t length = 0; |
| 50 | for (;;) { |
| 51 | if (!cni_bytes(c, 1)) { |
| 52 | return NULL; |
| 53 | } |
| 54 | if (!root[length]) { |
| 55 | break; |
| 56 | } |
| 57 | if (length == CNI_PATH_MAX) { |
| 58 | cni_fail(c, CBM_INVENTORY_LIMIT); |
| 59 | return NULL; |
| 60 | } |
| 61 | length++; |
| 62 | } |
| 63 | if (!length) { |
| 64 | cni_fail(c, CBM_INVENTORY_INVALID); |
| 65 | return NULL; |
| 66 | } |
| 67 | char *copy = cni_alloc(c, &c->temporary, length + 1, 1); |
| 68 | return copy && cni_copy(c, copy, root, length + 1) ? copy : NULL; |
| 69 | } |
| 70 | |
| 71 | static bool cni_file(cni_context *c, const cbm_pinned_tree_file_t *input, |
| 72 | cbm_inventory_file_t *output, size_t oid_width) { |
no test coverage detected