[gnome-usage] process: make sure we don't read past GTop.get_proc_argv's return value's length
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] process: make sure we don't read past GTop.get_proc_argv's return value's length
- Date: Fri, 19 Mar 2021 07:37:07 +0000 (UTC)
commit 70c436fea1ef9d7f5239d9b5e0b8870301548319
Author: Rasmus Thomsen <oss cogitri dev>
Date: Sat Sep 12 18:33:28 2020 +0200
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..e3ccea9 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 < uint.min (args.length, 2); i++) {
if (args[i] == null)
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]