| 2644 | } |
| 2645 | |
| 2646 | static bool generation_counter_parse(const char *text, uint64_t *out) { |
| 2647 | if (!text || !text[0] || (text[0] == '0' && text[1] != '\0')) { |
| 2648 | return false; |
| 2649 | } |
| 2650 | uint64_t value = 0; |
| 2651 | for (const unsigned char *p = (const unsigned char *)text; *p; p++) { |
| 2652 | if (*p < '0' || *p > '9') { |
| 2653 | return false; |
| 2654 | } |
| 2655 | uint64_t digit = (uint64_t)(*p - '0'); |
| 2656 | if (value > (UINT64_MAX - digit) / 10) { |
| 2657 | return false; |
| 2658 | } |
| 2659 | value = value * 10 + digit; |
| 2660 | } |
| 2661 | *out = value; |
| 2662 | return true; |
| 2663 | } |
| 2664 | |
| 2665 | /* Read and validate the two generation keys. Extra store_meta keys belong to |
| 2666 | * other store features and are deliberately ignored. */ |
no outgoing calls
no test coverage detected