snprintf(temp, sizeof(temp), ", playlist.%s AS p_thumbnail_path", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", playlist.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "playlist.%s", col_ptr->name);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
snprintf(temp, sizeof(temp), ", media_count IS NOT NULL AS media_count, playlist_map.%s AS pm_id", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", playlist_map.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
col_ptr = g_slist_nth_data(column_list[MEDIA_SVC_DB_LIST_MEDIA], i);
if (col_ptr->is_view) {
snprintf(temp, sizeof(temp), ", media.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
if (col_ptr->is_view) {
if (sflag == true) {
snprintf(temp, sizeof(temp), ", tag.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "tag.%s", col_ptr->name);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
snprintf(temp, sizeof(temp), ", media_count IS NOT NULL AS media_count, tag_map.%s AS tm_id", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", tag_map.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
col_ptr = g_slist_nth_data(column_list[MEDIA_SVC_DB_LIST_MEDIA], i);
if (col_ptr->is_view) {
snprintf(temp, sizeof(temp), ", media.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
if (col_ptr->has_option) {
if (sflag == true) {
snprintf(temp, sizeof(temp), ", %s %s %s", col_ptr->name, col_ptr->type, col_ptr->option);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "%s %s %s", col_ptr->name, col_ptr->type, col_ptr->option);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
} else {
if (sflag == true) {
snprintf(temp, sizeof(temp), ", %s %s", col_ptr->name, col_ptr->type);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "%s %s", col_ptr->name, col_ptr->type);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
if (col_ptr->is_unique) {
if (table_sub_len > 0) {
snprintf(temp, sizeof(temp), ", %s", col_ptr->name);
- strncat(table_query_sub, temp, strlen(temp));
- table_sub_len = strlen(table_query_sub);
} else {
snprintf(temp, sizeof(temp), "%s", col_ptr->name);
- strncpy(table_query_sub, temp, strlen(temp));
- table_sub_len = strlen(table_query_sub);
}
+ SAFE_STRLCAT(table_query_sub, temp, sizeof(table_query_sub));
+ table_sub_len = strlen(table_query_sub);
}
memset(temp, 0, sizeof(temp));
if (col_ptr->is_index) {
if (index_len > 0) {
snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_INDEX, col_ptr->index_name, table_name, col_ptr->name);
- strncat(index_query, temp, strlen(temp));
- index_len = strlen(index_query);
} else {
snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_INDEX, col_ptr->index_name, table_name, col_ptr->name);
- strncpy(index_query, temp, strlen(temp));
- index_len = strlen(index_query);
}
+ SAFE_STRLCAT(index_query, temp, sizeof(index_query));
+ index_len = strlen(index_query);
}
memset(temp, 0, sizeof(temp));
if (col_ptr->is_trigger) {
if (STRING_VALID(tb->trigger_name)) {
if (strncmp(table_name, MEDIA_SVC_DB_TABLE_ALBUM, strlen(MEDIA_SVC_DB_TABLE_ALBUM)) == 0) {
- snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_TRIGGER_WITH_COUNT, tb->trigger_name, tb->event_table, tb->action_table, tb->event_table, col_ptr->name, col_ptr->name, col_ptr->name, col_ptr->name);
- strncpy(trigger_query, temp, strlen(temp));
- trigger_len = strlen(trigger_query);
+ snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_TRIGGER_WITH_COUNT, tb->trigger_name, tb->event_table, tb->action_table, tb->event_table, col_ptr->name, col_ptr->name, col_ptr->name, col_ptr->name);
} else {
snprintf(temp, sizeof(temp), MEDIA_SVC_DB_QUERY_TRIGGER, tb->trigger_name, tb->event_table, tb->action_table, col_ptr->name, col_ptr->name);
- strncpy(trigger_query, temp, strlen(temp));
- trigger_len = strlen(trigger_query);
}
+ SAFE_STRLCAT(trigger_query, temp, sizeof(trigger_query));
+ trigger_len = strlen(trigger_query);
} else {
media_svc_error("invalid trigger name");
}
snprintf(temp, sizeof(temp), ", playlist.%s AS p_thumbnail_path", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", playlist.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "playlist.%s", col_ptr->name);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
snprintf(temp, sizeof(temp), ", media_count IS NOT NULL AS media_count, playlist_map.%s AS pm_id", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", playlist_map.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
col_ptr = g_slist_nth_data(column_list[MEDIA_SVC_DB_LIST_MEDIA], i);
if (col_ptr->is_view) {
snprintf(temp, sizeof(temp), ", media.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
if (col_ptr->is_view) {
if (sflag == true) {
snprintf(temp, sizeof(temp), ", tag.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
} else {
snprintf(temp, sizeof(temp), "tag.%s", col_ptr->name);
- strncpy(table_query, temp, strlen(temp));
sflag = true;
}
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
snprintf(temp, sizeof(temp), ", media_count IS NOT NULL AS media_count, tag_map.%s AS tm_id", col_ptr->name);
else
snprintf(temp, sizeof(temp), ", tag_map.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
col_ptr = g_slist_nth_data(column_list[MEDIA_SVC_DB_LIST_MEDIA], i);
if (col_ptr->is_view) {
snprintf(temp, sizeof(temp), ", media.%s", col_ptr->name);
- strncat(table_query, temp, strlen(temp));
+ SAFE_STRLCAT(table_query, temp, sizeof(table_query));
}
memset(temp, 0, sizeof(temp));
}
/* column limit = 2000 */
}
- strncat(query_bundle, sql, query_len);
+ SAFE_STRLCAT(query_bundle, sql, sizeof(query_bundle));
total_len += query_len;
SQLITE3_SAFE_FREE(sql);
char append_query[128] = {0, };
memset(append_query, 0x00, sizeof(append_query));
snprintf(append_query, sizeof(append_query), " UNION SELECT * from '%s'", storage_id);
- strncat(view_query, append_query, strlen(append_query));
+ SAFE_STRLCAT(view_query, append_query, sizeof(view_query));
} else {
media_svc_error("media table not exist for storage [%s]", storage_id);
}