From: jeon Date: Tue, 17 Sep 2019 12:51:17 +0000 (+0900) Subject: default_backend: fix some svace issues X-Git-Tag: accepted/tizen/5.5/unified/20200102.014046~11 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibpui.git;a=commitdiff_plain;h=d65964b74291727e8eba2804593c8ab6150f5b01 default_backend: fix some svace issues Change-Id: I78fe3f4efc5723e93baf6227f9accb5a43d56f1a --- diff --git a/backends/default_backend.c b/backends/default_backend.c index 390bfab..5d71cf2 100644 --- a/backends/default_backend.c +++ b/backends/default_backend.c @@ -24,6 +24,7 @@ */ #include "default_backend.h" +#include pui_backend_ani_func *ani_func = NULL; Eina_Hash *_animations_hash = NULL; @@ -205,15 +206,17 @@ static char * _read_json_file(const char *path, int *data_size) { FILE *fp = fopen(path, "rb"); - unsigned int size; - char *buffer; + int size; + char *buffer = NULL; ERROR_CHECK(fp, return NULL, "Failed to open file: %s\n", path); fseek(fp, 0, SEEK_END); - size = (unsigned int)ftell(fp); + size = (long int)ftell(fp); fseek(fp, 0, SEEK_SET); + ERROR_CHECK(0 < size && size < INT_MAX, goto error, "Invalid file: %d size\n", size); buffer = (char *)calloc(sizeof(char), size + 1); + ERROR_CHECK(buffer, goto error, "Failed to allocate memory for buffer\n"); if (fread(buffer, size, 1, fp) < 1) { goto error;