From a42a419377255faa29f458a7b932352f7e3fadeb Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 21 Oct 2013 18:54:04 +0900 Subject: [PATCH] Explicitly set NULL for makring end of file buffer Change-Id: Ic6b607392a5c2438bf0aaf2cc2168b00e8488a71 --- packaging/data-provider-master.spec | 2 +- src/script_handler.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 3184325..23dd42d 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -1,6 +1,6 @@ Name: data-provider-master Summary: Master service provider for liveboxes -Version: 0.25.17 +Version: 0.25.18 Release: 1 Group: HomeTF/Livebox License: Flora License diff --git a/src/script_handler.c b/src/script_handler.c index a4af88c..3d298de 100644 --- a/src/script_handler.c +++ b/src/script_handler.c @@ -1165,7 +1165,7 @@ static inline char *load_file(const char *filename) goto errout; } - filebuf = malloc(filesize); + filebuf = malloc(filesize + 1); if (!filebuf) { ErrPrint("malloc: %s\n", strerror(errno)); goto errout; @@ -1188,6 +1188,10 @@ static inline char *load_file(const char *filename) readsize += ret; } + if (filebuf) { + filebuf[readsize] = '\0'; + } + /*! * \note * Now, we are ready to parse the filebuf. @@ -1468,6 +1472,7 @@ HAPI int script_handler_parse_desc(struct inst_info *inst, const char *filename, state = BEGIN; block->filename = filename; block_list = eina_list_append(block_list, block); + block = NULL; } else { state = FIELD; continue; -- 2.7.4