Fixed Coverity issue
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5fbeb4b8 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5fbeb4b8 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5fbeb4b8 Branch: refs/heads/master Commit: 5fbeb4b8e3a0f84847d368b6bcff6909aca8e034 Parents: 27b9648 Author: gricciardi <[email protected]> Authored: Wed Nov 8 21:05:37 2017 +0100 Committer: gricciardi <[email protected]> Committed: Wed Nov 8 21:05:37 2017 +0100 ---------------------------------------------------------------------- .../private/src/pubsub_serializer_impl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/5fbeb4b8/pubsub/pubsub_serializer_json/private/src/pubsub_serializer_impl.c ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_serializer_json/private/src/pubsub_serializer_impl.c b/pubsub/pubsub_serializer_json/private/src/pubsub_serializer_impl.c index 7f56c52..685d499 100644 --- a/pubsub/pubsub_serializer_json/private/src/pubsub_serializer_impl.c +++ b/pubsub/pubsub_serializer_json/private/src/pubsub_serializer_impl.c @@ -42,6 +42,7 @@ #include "pubsub_serializer_impl.h" #define SYSTEM_BUNDLE_ARCHIVE_PATH "CELIX_FRAMEWORK_EXTENDER_PATH" +#define MAX_PATH_LEN 1024 static char* pubsubSerializer_getMsgDescriptionDir(bundle_pt bundle); static void pubsubSerializer_addMsgSerializerFromBundle(const char *root, bundle_pt bundle, hash_map_pt msgTypesMap); @@ -212,7 +213,7 @@ static char* pubsubSerializer_getMsgDescriptionDir(bundle_pt bundle) static void pubsubSerializer_addMsgSerializerFromBundle(const char *root, bundle_pt bundle, hash_map_pt msgSerializers) { - char path[128]; + char path[MAX_PATH_LEN]; struct dirent *entry = NULL; DIR *dir = opendir(root); @@ -226,8 +227,7 @@ static void pubsubSerializer_addMsgSerializerFromBundle(const char *root, bundle printf("DMU: Parsing entry '%s'\n", entry->d_name); - memset(path,0,1024); - snprintf(path, 1024, "%s/%s", root, entry->d_name); + snprintf(path, MAX_PATH_LEN, "%s/%s", root, entry->d_name); FILE *stream = fopen(path,"r"); if (stream != NULL){
