fix(chat): reject truncated or malformed stored owner JSON before comparison
This commit is contained in:
1 parent
803f5fe112
commit
6f6fdae4b2
1 file changed
+4
-1
@@ -587,7 +587,10 @@ static int member_apply_record(struct UTUN_INSTANCE* inst, const char* ch_id,
|
||||
local_join_ts = (uint64_t)sqlite3_column_int64(st, 1);
|
||||
local_update_ts = (uint64_t)sqlite3_column_int64(st, 2);
|
||||
const char* tags = (const char*)sqlite3_column_text(st, 3);
|
||||
if (tags) snprintf(local_tags, sizeof(local_tags), "%s", tags);
|
||||
int tags_type = sqlite3_column_type(st, 3), tags_bytes = sqlite3_column_bytes(st, 3);
|
||||
if (tags_type != SQLITE_NULL && (tags_type != SQLITE_TEXT || !tags || tags_bytes > MS_ADM_TAGS_MAX ||
|
||||
strlen(tags) != (size_t)tags_bytes)) rc = SQLITE_CORRUPT;
|
||||
else if (tags) memcpy(local_tags, tags, (size_t)tags_bytes + 1);
|
||||
local_signed_by = (uint64_t)sqlite3_column_int64(st, 4);
|
||||
const uint8_t* ls = (const uint8_t*)sqlite3_column_blob(st, 5);
|
||||
if (ls && sqlite3_column_bytes(st, 5) >= 64) memcpy(local_signature, ls, 64);
|
||||
|
||||
Reference in new issue
Block a user