core: don't assert when serializing malformed state

This commit is contained in:
Frantisek Sumsal
2023-10-18 22:44:16 +02:00
parent 81c4be64da
commit 892eb4d795
4 changed files with 28 additions and 16 deletions
+6 -2
View File
@@ -207,7 +207,9 @@ int serialize_item_hexmem(FILE *f, const char *key, const void *p, size_t l) {
assert(f);
assert(key);
assert(p || l == 0);
if (!p && l > 0)
return -EINVAL;
if (l == 0)
return 0;
@@ -230,7 +232,9 @@ int serialize_item_base64mem(FILE *f, const char *key, const void *p, size_t l)
assert(f);
assert(key);
assert(p || l == 0);
if (!p && l > 0)
return -EINVAL;
if (l == 0)
return 0;