| 149 | } |
| 150 | |
| 151 | static int text_bounded_strlen(const char *text, size_t maximum, size_t *len_out) { |
| 152 | if (!text || !len_out) { |
| 153 | return TEXT_ERROR; |
| 154 | } |
| 155 | size_t len = 0U; |
| 156 | while (len <= maximum && text[len] != '\0') { |
| 157 | len++; |
| 158 | } |
| 159 | if (len > maximum) { |
| 160 | return TEXT_ERROR; |
| 161 | } |
| 162 | *len_out = len; |
| 163 | return TEXT_OK; |
| 164 | } |
| 165 | |
| 166 | static int text_decode_utf8(const unsigned char *text, size_t remaining, uint32_t *codepoint, |
| 167 | size_t *byte_count) { |
no outgoing calls
no test coverage detected