A plain JSON string property (an image reference holds no escapes). */
| 1771 | |
| 1772 | /* A plain JSON string property (an image reference holds no escapes). */ |
| 1773 | static bool dk_prop(const char *props, const char *key, char *out, size_t out_sz) { |
| 1774 | char pat[CBM_SZ_64]; |
| 1775 | snprintf(pat, sizeof(pat), "\"%s\":\"", key); |
| 1776 | const char *p = props ? strstr(props, pat) : NULL; |
| 1777 | if (!p) { |
| 1778 | return false; |
| 1779 | } |
| 1780 | p += strlen(pat); |
| 1781 | const char *e = strchr(p, '"'); |
| 1782 | if (!e || (size_t)(e - p) >= out_sz || memchr(p, '\\', (size_t)(e - p))) { |
| 1783 | return false; |
| 1784 | } |
| 1785 | memcpy(out, p, (size_t)(e - p)); |
| 1786 | out[e - p] = '\0'; |
| 1787 | return true; |
| 1788 | } |
| 1789 | |
| 1790 | /* The tag of image reference `ref`: after the ':' that follows its last |
| 1791 | * '/' (a registry port is no tag), up to a '@' digest; "" for none. */ |
no outgoing calls
no test coverage detected