| 16 | } |
| 17 | |
| 18 | static bool parse_bounded_uint64(const char *value, uint64_t maximum, uint64_t *parsed) { |
| 19 | if (!value || !value[0] || !parsed) { |
| 20 | return false; |
| 21 | } |
| 22 | uint64_t result = 0; |
| 23 | for (const unsigned char *cursor = (const unsigned char *)value; *cursor; cursor++) { |
| 24 | if (*cursor < '0' || *cursor > '9') { |
| 25 | return false; |
| 26 | } |
| 27 | uint64_t digit = (uint64_t)(*cursor - '0'); |
| 28 | if (result > (maximum - digit) / 10U) { |
| 29 | return false; |
| 30 | } |
| 31 | result = result * 10U + digit; |
| 32 | } |
| 33 | if (result == 0) { |
| 34 | return false; |
| 35 | } |
| 36 | *parsed = result; |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | void cbm_index_policy_init(cbm_index_resource_policy_t *policy) { |
| 41 | if (policy) { |
no outgoing calls
no test coverage detected