mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-22 09:01:39 +01:00
32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
Upstream: Yes, https://gitlab.gnome.org/GNOME/gnome-usage/-/merge_requests/79
|
|
From 8d56db29248ef9e056a58eedee7d99dcc1efa0e6 Mon Sep 17 00:00:00 2001
|
|
From: Rasmus Thomsen <oss@cogitri.dev>
|
|
Date: Sat, 12 Sep 2020 18:33:28 +0200
|
|
Subject: [PATCH] process: make sure we don't read past GTop.get_proc_argv's
|
|
return value's length
|
|
|
|
If a process doesn't have any arguments passed to it its argv will only
|
|
have a size of 1 - its own name
|
|
|
|
fixes #80
|
|
---
|
|
src/process.vala | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/process.vala b/src/process.vala
|
|
index 1f0722f..804c791 100644
|
|
--- a/src/process.vala
|
|
+++ b/src/process.vala
|
|
@@ -106,7 +106,7 @@ namespace Usage
|
|
/* cmd is most likely a truncated version, therefore
|
|
* we check the first two arguments of the full argv
|
|
* vector if they match cmd and if so, use that */
|
|
- for (int i = 0; i < 2; i++) {
|
|
+ for (int i = 0; i < (args.length > 1 ? 2 : args.length); i++) {
|
|
if (args[i] == null)
|
|
continue;
|
|
|
|
--
|
|
GitLab
|
|
|