goto out;
}
- snprintf(value, len, "%s", d_data.dptr);
+ if (len <= d_data.dsize) {
+ _E("Buffer size is smaller than DB value size. It can be cut");
+ d_data.dsize = len - 1;
+ }
+
+ memcpy(value, d_data.dptr, d_data.dsize);
+ value[d_data.dsize] = '\0';
free(d_data.dptr);
ret = SYSTEM_INFO_ERROR_NONE;
*type = info_type[i].type_e;
ret = SYSTEM_INFO_ERROR_NONE;
- g_hash_table_insert(hashtable, strdup(key_internal), strdup(d_data.dptr));
+ g_hash_table_insert(hashtable, strndup(key_internal, d_key.dsize),
+ strndup(d_data.dptr, d_data.dsize));
+ free(d_data.dptr);
goto out;
}
}
static int system_info_get_bool(enum tag_type tag, const char *key, bool *value)
{
int ret;
- char val[8];
+ char val[16];
char *valp;
size_t len;
const char *runtime_type;
API int system_info_get_custom_type(const char *key, system_info_type_e *type)
{
int ret;
- char *val;
+ char *val = NULL;
size_t len;
ret = system_info_get_type(TAG_TYPE_CUSTOM, key, type);
*type = SYSTEM_INFO_STRING;
else {
_E("Invalid type (%s)", val);
+ free(val);
return SYSTEM_INFO_ERROR_INVALID_PARAMETER;
}
+ free(val);
return SYSTEM_INFO_ERROR_NONE;
//LCOV_EXCL_STOP
}