backport patch to check value for topic
This commit is contained in:
parent
38075382ee
commit
8bbd4c6ec6
50
Backport-check-value-for-topic.patch
Normal file
50
Backport-check-value-for-topic.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 585ac671ed21faa9d84cbab1609f2557857e5204 Mon Sep 17 00:00:00 2001
|
||||
From: zgzxx <zhangguangzhi3@huawei.com>
|
||||
Date: Tue, 21 Nov 2023 21:21:26 +0800
|
||||
Subject: [PATCH] check value for topic
|
||||
|
||||
---
|
||||
lib/secDetector_sdk.cpp | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/secDetector_sdk.cpp b/lib/secDetector_sdk.cpp
|
||||
index 208f4ac..ee76079 100644
|
||||
--- a/lib/secDetector_sdk.cpp
|
||||
+++ b/lib/secDetector_sdk.cpp
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <iostream>
|
||||
#include "../observer_agent/grpc_comm/grpc_api.h"
|
||||
|
||||
-#define ALLTOPIC 0x008FFFFF
|
||||
+#define ALLTOPIC 0x00FFFFFF
|
||||
using namespace std;
|
||||
static string server_address("unix:///var/run/secDetector.sock");
|
||||
static PubSubClient g_client(grpc::CreateChannel(server_address, grpc::InsecureChannelCredentials()));
|
||||
@@ -32,8 +32,10 @@ extern "C" {
|
||||
|
||||
void *secSub(const int topic)
|
||||
{
|
||||
- if (!(topic & ALLTOPIC))
|
||||
+ if (topic <= 0 || topic > ALLTOPIC) {
|
||||
+ printf("secSub failed, topic:%d is error\n", topic);
|
||||
return NULL;
|
||||
+ }
|
||||
|
||||
unique_ptr<ClientReader<Message>> reader = g_client.Subscribe(topic);
|
||||
|
||||
@@ -47,8 +49,10 @@ void *secSub(const int topic)
|
||||
|
||||
void secUnsub(const int topic, void *reader)
|
||||
{
|
||||
- if (!(topic & ALLTOPIC))
|
||||
- return;
|
||||
+ if (topic <= 0 || topic > ALLTOPIC) {
|
||||
+ printf("secUnsub failed, topic:%d is error\n", topic);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
if (!reader)
|
||||
return;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
Name : secDetector
|
||||
Summary : OS Security Intrusion Detection System
|
||||
Version : 1.0
|
||||
Release : 3
|
||||
Release : 4
|
||||
License : GPL-2.0
|
||||
Source0 : %{name}-v%{version}.tar.gz
|
||||
BuildRequires: kernel-devel kernel-headers
|
||||
@ -17,6 +17,7 @@ Requires : protobuf grpc libuuid libbpf
|
||||
|
||||
Patch0001: 0001-fix-report-api-function.patch
|
||||
Patch0002: Backport-service-fix-power_of_2-bug.patch
|
||||
Patch0003: Backport-check-value-for-topic.patch
|
||||
|
||||
%description
|
||||
OS Security Intrusion Detection System
|
||||
@ -90,6 +91,9 @@ rm -rf %{buildroot}
|
||||
%attr(0644,root,root) /usr/include/secDetector/secDetector_topic.h
|
||||
|
||||
%changelog
|
||||
* Wed Nov 22 2023 zhangguangzhi <zhangguangzhi3@huawei.com> 1.0-4
|
||||
- add patch to check value for topic
|
||||
|
||||
* Tue Nov 21 2023 chenjingwen6 <lhchenjw@gmail.com> 1.0-3
|
||||
- add patch to fix power_of_2 bug
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user