obuspa: Fix probable segfault

This commit is contained in:
Vivek Kumar Dutta 2024-11-04 10:27:20 +05:30
parent b66ae8d605
commit 6d6ecdfe92
4 changed files with 43 additions and 30 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=9.0.0.12
PKG_VERSION:=9.0.0.13
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
PKG_SOURCE_VERSION:=83784445e5254238aef38c9b27f182cc504f395a
PKG_SOURCE_VERSION:=e03590ce186a4cb4b565322ccd8bd60195c54a2a
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip

View file

@ -1,6 +1,8 @@
--- a/src/core/device.h
+++ b/src/core/device.h
@@ -336,6 +336,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
Index: obuspa-9.0.0.13/src/core/device.h
===================================================================
--- obuspa-9.0.0.13.orig/src/core/device.h
+++ obuspa-9.0.0.13/src/core/device.h
@@ -338,6 +338,10 @@ void DEVICE_CONTROLLER_SetInheritedRole(
int DEVICE_CONTROLLER_CountEnabledWebsockClientConnections(void);
#endif
@ -11,8 +13,10 @@
#ifndef REMOVE_USP_BROKER
int DEVICE_SUBSCRIPTION_RouteNotification(Usp__Msg *usp, int instance);
bool DEVICE_SUBSCRIPTION_MarkVendorLayerSubs(int broker_instance, subs_notify_t notify_type, char *path, int group_id);
--- a/src/core/device_controller.c
+++ b/src/core/device_controller.c
Index: obuspa-9.0.0.13/src/core/device_controller.c
===================================================================
--- obuspa-9.0.0.13.orig/src/core/device_controller.c
+++ obuspa-9.0.0.13/src/core/device_controller.c
@@ -967,6 +967,78 @@ int DEVICE_CONTROLLER_QueueBinaryMessage
return USP_ERR_OK;
}
@ -92,8 +96,10 @@
/*********************************************************************//**
**
** DEVICE_CONTROLLER_IsMTPConfigured
--- a/src/core/msg_handler.c
+++ b/src/core/msg_handler.c
Index: obuspa-9.0.0.13/src/core/msg_handler.c
===================================================================
--- obuspa-9.0.0.13.orig/src/core/msg_handler.c
+++ obuspa-9.0.0.13/src/core/msg_handler.c
@@ -1210,6 +1210,15 @@ int ValidateUspRecord(UspRecord__Record
usp_service_instance = USP_BROKER_GetUspServiceInstance(rec->from_id, 0);
#endif

View file

@ -1,6 +1,8 @@
--- a/src/core/mqtt.c
+++ b/src/core/mqtt.c
@@ -254,6 +254,8 @@ void QueueUspRecord_MQTT(mqtt_client_t *
Index: obuspa-9.0.0.13/src/core/mqtt.c
===================================================================
--- obuspa-9.0.0.13.orig/src/core/mqtt.c
+++ obuspa-9.0.0.13/src/core/mqtt.c
@@ -256,6 +256,8 @@ void MqttSubscriptionDestroy(mqtt_subscr
#define DEFINE_MQTT_TrustCertVerifyCallbackIndex(index) \
int MQTT_TrustCertVerifyCallback_##index (int preverify_ok, X509_STORE_CTX *x509_ctx) \
{\
@ -9,7 +11,7 @@
return DEVICE_SECURITY_TrustCertVerifyCallbackWithCertChain(preverify_ok, x509_ctx, &mqtt_clients[index].cert_chain);\
}
@@ -264,6 +266,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex
@@ -266,6 +268,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex
DEFINE_MQTT_TrustCertVerifyCallbackIndex(2);
DEFINE_MQTT_TrustCertVerifyCallbackIndex(3);
DEFINE_MQTT_TrustCertVerifyCallbackIndex(4);
@ -21,7 +23,7 @@
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
//------------------------------------------------------------------------------------
@@ -274,10 +281,15 @@ ssl_verify_callback_t* mqtt_verify_callb
@@ -276,10 +283,15 @@ ssl_verify_callback_t* mqtt_verify_callb
MQTT_TrustCertVerifyCallbackIndex(2),
MQTT_TrustCertVerifyCallbackIndex(3),
MQTT_TrustCertVerifyCallbackIndex(4),

View file

@ -1,34 +1,39 @@
diff --git a/src/core/cli_server.c b/src/core/cli_server.c
index d45555a..c65e96a 100644
--- a/src/core/cli_server.c
+++ b/src/core/cli_server.c
@@ -753,6 +753,10 @@ int ExecuteCli_Get(char *arg1, char *arg2, char *usage)
Index: obuspa-9.0.0.13/src/core/cli_server.c
===================================================================
--- obuspa-9.0.0.13.orig/src/core/cli_server.c
+++ obuspa-9.0.0.13/src/core/cli_server.c
@@ -753,6 +753,15 @@ int ExecuteCli_Get(char *arg1, char *arg
}
#endif
+ char *path[2] = {0};
+
+ path[0] = arg1;
+ vendor_create_dm_cache(path, 1);
+ if (arg1 == NULL) {
+ vendor_create_dm_cache(path, 0);
+ } else {
+ vendor_create_dm_cache(path, 1);
+ }
+
// Exit if unable to get a list of all parameters referenced by the expression
STR_VECTOR_Init(&params);
INT_VECTOR_Init(&group_ids);
diff --git a/src/core/data_model.h b/src/core/data_model.h
index b9dc686..0767d02 100755
--- a/src/core/data_model.h
+++ b/src/core/data_model.h
@@ -371,5 +371,6 @@ bool DM_PRIV_IsChildOf(char *path, dm_node_t *parent_node);
Index: obuspa-9.0.0.13/src/core/data_model.h
===================================================================
--- obuspa-9.0.0.13.orig/src/core/data_model.h
+++ obuspa-9.0.0.13/src/core/data_model.h
@@ -371,5 +371,6 @@ bool DM_PRIV_IsChildOf(char *path, dm_no
bool DM_PRIV_IsChildNodeOf(dm_node_t *node, dm_node_t *parent_node);
bool DM_PRIV_AreAllChildrenGroupId(dm_node_t *parent, int group_id);
+int vendor_create_dm_cache(char *paths[], int num_paths);
#endif
diff --git a/src/core/handle_get.c b/src/core/handle_get.c
index 170d27d..de3a755 100644
--- a/src/core/handle_get.c
+++ b/src/core/handle_get.c
@@ -143,6 +143,7 @@ void MSG_HANDLER_HandleGet(Usp__Msg *usp, char *controller_endpoint, mtp_conn_t
Index: obuspa-9.0.0.13/src/core/handle_get.c
===================================================================
--- obuspa-9.0.0.13.orig/src/core/handle_get.c
+++ obuspa-9.0.0.13/src/core/handle_get.c
@@ -143,6 +143,7 @@ void MSG_HANDLER_HandleGet(Usp__Msg *usp
ExpandGetPathExpression(i, path_exprs[i], (int)depth, &get_expr_info[i], &ggv);
}