From 5fff3b8161df7591e5d13c37f05ea0689faad728 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 9 Nov 2023 00:08:04 +0000 Subject: [PATCH] Following asan fixes. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4624 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ssb.db.c b/src/ssb.db.c index 4d576bb3..ff7f50a1 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -1334,7 +1334,7 @@ static bool _remove_following_entry(following_t*** list, int* count, following_t { 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)); (*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) { const char* contact = (const char*)sqlite3_column_text(statement, 0); + if (!contact) + { + continue; + } if (sqlite3_column_type(statement, 1) != SQLITE_NULL) { bool is_following = sqlite3_column_int(statement, 1) != 0;