This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch support/2.4
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 9acb9f69357b817bea15bd3ed129dbf0f928f3d6
Author: xuzhenbao <[email protected]>
AuthorDate: Thu Nov 23 22:10:59 2023 +0800

    Resolve coverity issue
    
    (cherry picked from commit fee0991baf66ef171f0d449bb7f196b611119583)
---
 libs/dfi/src/dyn_function.c | 2 +-
 libs/dfi/src/dyn_type.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/dfi/src/dyn_function.c b/libs/dfi/src/dyn_function.c
index dc09ec66..1b6666cc 100644
--- a/libs/dfi/src/dyn_function.c
+++ b/libs/dfi/src/dyn_function.c
@@ -93,7 +93,7 @@ int dynFunction_parse(FILE *descriptor, struct types_head 
*refTypes, dyn_functio
 
 int dynFunction_parseWithStr(const char *descriptor, struct types_head 
*refTypes, dyn_function_type **out)  {
     int status = OK;
-    FILE *stream = fmemopen((char *)descriptor, strlen(descriptor), "r");
+    FILE *stream = fmemopen((char *)descriptor, strlen(descriptor) + 1, "r");
     if (stream != NULL) {
         status = dynFunction_parse(stream, refTypes, out);
         fclose(stream);
diff --git a/libs/dfi/src/dyn_type.c b/libs/dfi/src/dyn_type.c
index 45f9d3e1..6ed3bb4f 100644
--- a/libs/dfi/src/dyn_type.c
+++ b/libs/dfi/src/dyn_type.c
@@ -88,7 +88,7 @@ int dynType_parse(FILE *descriptorStream, const char *name, 
struct types_head *r
 
 int dynType_parseWithStr(const char *descriptor, const char *name, struct 
types_head *refTypes, dyn_type **type) {
     int status = OK;
-    FILE *stream = fmemopen((char *)descriptor, strlen(descriptor), "r");
+    FILE *stream = fmemopen((char *)descriptor, strlen(descriptor) + 1, "r");
     if (stream != NULL) {
         status = dynType_parseWithStream(stream, name, NULL, refTypes, type);
         if (status == OK) {

Reply via email to