Following asan fixes.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4624 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-11-09 00:08:04 +00:00
parent b4236d0ec0
commit 5fff3b8161

View File

@ -1334,7 +1334,7 @@ static bool _remove_following_entry(following_t*** list, int* count, following_t
{ {
if (*count - index > 1) if (*count - index > 1)
{ {
memmove(*list + index, *list + index + 1, sizeof(following_t*) * (*count - index)); memmove(*list + index, *list + index + 1, sizeof(following_t*) * (*count - index - 1));
} }
*list = tf_resize_vec(*list, sizeof(**list) * (*count - 1)); *list = tf_resize_vec(*list, sizeof(**list) * (*count - 1));
(*count)--; (*count)--;
@ -1383,6 +1383,10 @@ static following_t* _get_following(tf_ssb_t* ssb, const char* id, following_t***
while (sqlite3_step(statement) == SQLITE_ROW) while (sqlite3_step(statement) == SQLITE_ROW)
{ {
const char* contact = (const char*)sqlite3_column_text(statement, 0); const char* contact = (const char*)sqlite3_column_text(statement, 0);
if (!contact)
{
continue;
}
if (sqlite3_column_type(statement, 1) != SQLITE_NULL) if (sqlite3_column_type(statement, 1) != SQLITE_NULL)
{ {
bool is_following = sqlite3_column_int(statement, 1) != 0; bool is_following = sqlite3_column_int(statement, 1) != 0;