Merge pull request #3634 from 94xhn/fix/json-hex-validation

Reject malformed input in mg_json_get_hex
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2026-07-24 11:36:31 -03:00
commit f8e785f56b
5 files changed
+29 -13

No files matched your search

+1 -1
View File
@@ -4163,7 +4163,7 @@ char *mg_json_get_str(struct mg_str json, const char *path);
// Decodes a hex-encoded JSON string at path into a heap-allocated byte array.
// Sets *len to the decoded byte count. Caller must mg_free() the result.
// Returns NULL if not found or not a string.
// Returns NULL if not found, not a string, or not valid hexadecimal.
char *mg_json_get_hex(struct mg_str json, const char *path, int *len);
// Decodes a base64-encoded JSON string at path into a heap-allocated byte