*
* Copyright 2012 Samsung Electronics Co., Ltd
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
const char *space = " ";
int len = strlen(filewithpath);
- if (len > 20) {
+ if (len >= 20) {
strptr = (char *) filewithpath + (len - 20);
start = 0;
} else if (len < 20) {
}
strncpy((char *) filename, space, strlen(space));
- strncpy((char *) filename + start, strptr, 50);
+ if(strptr)
+ strncpy((char *) filename + start, strptr, 50);
return (char *) filename;
#endif
size_t size = 0;
- WFD_RET_IF(data == NULL || key == NULL || type == 0, , "Invialid parameter!");
+ WFD_RET_IF(data == NULL || key == NULL || type == 0, "Invialid parameter!");
app_control_h control = data;
if (type == BUNDLE_TYPE_STR) {
bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
buff = malloc(sizeof(char) * size + 1);
+ if (buff == NULL) {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+ __WFD_APP_FUNC_EXIT__;
+ return;
+ }
snprintf(buff, size + 1, "%s", ((char*) ptr));
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
} else if (type == BUNDLE_TYPE_BYTE) {
bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
buff = malloc(sizeof(char) * size + 1);
+ if (buff == NULL) {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+ __WFD_APP_FUNC_EXIT__;
+ return;
+ }
snprintf(buff, size + 1, "%s", ((char*) ptr));
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);