[glib/glib-2-72: 23/39] Fix check before a memcpy
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-72: 23/39] Fix check before a memcpy
- Date: Tue, 20 Sep 2022 19:07:39 +0000 (UTC)
commit df1e7dc5db8d29bff4609005d7af9e994c90f626
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Sep 2 12:52:35 2022 +0100
Fix check before a memcpy
The search_total_results address is always going to be non-zero, so the
check will always evaluate to true, and GCC is kind enough to point this
out to us.
The appropriate fix is checking if the size of the search results array
is larger than zero, and if so, copy them into the total results array.
(cherry-picked from commit e08c954693fdcfceda2de59cca93a76125f4fca6)
gio/gdesktopappinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index a355745163..7d9c3daf1c 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -706,7 +706,7 @@ merge_directory_results (void)
static_total_results = g_renew (struct search_result, static_total_results,
static_total_results_allocated);
}
- if (static_total_results + static_total_results_size != 0)
+ if (static_search_results_size != 0)
memcpy (static_total_results + static_total_results_size,
static_search_results,
static_search_results_size * sizeof (struct search_result));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]