| 329 | } |
| 330 | |
| 331 | static bool runtime_wire_string_decode(const uint8_t *in, size_t capacity, char *out, |
| 332 | bool allow_empty) { |
| 333 | if (!in || !out || capacity == 0) { |
| 334 | return false; |
| 335 | } |
| 336 | size_t length = capacity; |
| 337 | for (size_t i = 0; i < capacity; i++) { |
| 338 | if (in[i] == 0) { |
| 339 | length = i; |
| 340 | break; |
| 341 | } |
| 342 | } |
| 343 | if (length == capacity || (!allow_empty && length == 0)) { |
| 344 | return false; |
| 345 | } |
| 346 | for (size_t i = length + 1; i < capacity; i++) { |
| 347 | if (in[i] != 0) { |
| 348 | return false; |
| 349 | } |
| 350 | } |
| 351 | memcpy(out, in, length); |
| 352 | out[length] = '\0'; |
| 353 | return true; |
| 354 | } |
| 355 | |
| 356 | /* Reuse the service layer's canonical printable-version and lowercase-SHA256 |
| 357 | * validation without importing detailed ABI values into rendezvous. Fixed |
no outgoing calls
no test coverage detected