| 436 | } |
| 437 | |
| 438 | static bool runtime_wire_string_decode(const uint8_t *in, size_t capacity, char *out, |
| 439 | bool allow_empty) { |
| 440 | if (!in || !out || capacity == 0) { |
| 441 | return false; |
| 442 | } |
| 443 | size_t length = capacity; |
| 444 | for (size_t i = 0; i < capacity; i++) { |
| 445 | if (in[i] == 0) { |
| 446 | length = i; |
| 447 | break; |
| 448 | } |
| 449 | } |
| 450 | if (length == capacity || (!allow_empty && length == 0)) { |
| 451 | return false; |
| 452 | } |
| 453 | for (size_t i = length + 1; i < capacity; i++) { |
| 454 | if (in[i] != 0) { |
| 455 | return false; |
| 456 | } |
| 457 | } |
| 458 | memcpy(out, in, length); |
| 459 | out[length] = '\0'; |
| 460 | return true; |
| 461 | } |
| 462 | |
| 463 | /* Reuse the service layer's canonical printable-version and lowercase-SHA256 |
| 464 | * validation without importing detailed ABI values into rendezvous. Fixed |
no outgoing calls
no test coverage detected