From: Hwankyu Jhun Date: Wed, 23 Dec 2015 01:11:23 +0000 (+0900) Subject: Add an exceptional handling X-Git-Tag: submit/tizen/20151223.023412^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0653b2c09c810073e5c3e60ca36bc8d56e15f19f;p=platform%2Fcore%2Fbase%2Fbundle.git Add an exceptional handling - If the argc is 1, the argv[1] is invalid access. Change-Id: I38a50c8b950cb781649d84aaab77a82fe24b7e72 Signed-off-by: Hwankyu Jhun --- diff --git a/src/bundle.c b/src/bundle.c index 31e09d2..0da2fea 100644 --- a/src/bundle.c +++ b/src/bundle.c @@ -843,42 +843,41 @@ int bundle_free_exported_argv(int argc, char ***argv) return BUNDLE_ERROR_NONE; } - bundle * -bundle_import_from_argv(int argc, char **argv) +bundle *bundle_import_from_argv(int argc, char **argv) { + int idx; + int type; + keyval_t *kv; + keyval_array_t *kva; + unsigned char *byte; + char *encoded_byte; + unsigned int byte_size; + bundle *b; + if (!argv) { set_last_result(BUNDLE_ERROR_INVALID_PARAMETER); return NULL; /* TC_FIX error handling for argv =NULL*/ } - bundle *b = bundle_create(); - if (!b) + b = bundle_create(); + if (!b) { + set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY); return NULL; + } - - /* - int i; - for(i=0; i