63 lines
2.0 KiB
Diff
63 lines
2.0 KiB
Diff
From 8359a7004de5e22c5a9b85c01c56e3b376d84a81 Mon Sep 17 00:00:00 2001
|
|
From: Michael Tautschnig <mt@debian.org>
|
|
Date: Thu, 2 Nov 2023 21:53:29 +0100
|
|
Subject: [PATCH] Make session id consistently typed (#327)
|
|
|
|
This fixes type-conflicting definitions and declarations.
|
|
|
|
Reference:https://github.com/linux-audit/audit-userspace/commit/8359a7004de5e22c5a9b85c01c56e3b376d84a81
|
|
Conflict:NA
|
|
|
|
---
|
|
src/aureport-options.c | 3 ++-
|
|
src/ausearch-options.c | 10 ++++++----
|
|
2 files changed, 8 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/aureport-options.c b/src/aureport-options.c
|
|
index 93621e25..76a4b9f1 100644
|
|
--- a/src/aureport-options.c
|
|
+++ b/src/aureport-options.c
|
|
@@ -61,7 +61,8 @@ const char *event_uuid = NULL;
|
|
const char *event_vmname = NULL;
|
|
long long event_exit = 0;
|
|
int event_exit_is_set = 0;
|
|
-int event_ppid = -1, event_session_id = -2;
|
|
+pid_t event_ppid = -1;
|
|
+uint32_t event_session_id = -2;
|
|
int event_debug = 0, event_machine = -1;
|
|
time_t arg_eoe_timeout = (time_t)0;
|
|
|
|
diff --git a/src/ausearch-options.c b/src/ausearch-options.c
|
|
index 8a1f4772..499c2aa3 100644
|
|
--- a/src/ausearch-options.c
|
|
+++ b/src/ausearch-options.c
|
|
@@ -895,19 +895,21 @@ int check_params(int count, char *vars[])
|
|
size_t len = strlen(optarg);
|
|
if (isdigit(optarg[0])) {
|
|
errno = 0;
|
|
- event_session_id = strtoul(optarg,NULL,10);
|
|
- if (errno)
|
|
+ unsigned long optval = strtoul(optarg,NULL,10);
|
|
+ if (errno || optval >= (1ul << 32))
|
|
retval = -1;
|
|
+ event_session_id = optval;
|
|
c++;
|
|
} else if (len >= 2 && *(optarg)=='-' &&
|
|
(isdigit(optarg[1]))) {
|
|
errno = 0;
|
|
- event_session_id = strtoul(optarg, NULL, 0);
|
|
- if (errno) {
|
|
+ long optval = strtol(optarg, NULL, 0);
|
|
+ if (errno || optval < INT_MIN || optval > INT_MAX) {
|
|
retval = -1;
|
|
fprintf(stderr, "Error converting %s\n",
|
|
optarg);
|
|
}
|
|
+ event_session_id = optval;
|
|
c++;
|
|
} else {
|
|
fprintf(stderr,
|
|
--
|
|
2.33.0
|
|
|