From 9a500d13055f16b70796a5fce5ec6de4a2844187 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Tue, 13 Jul 2004 21:10:06 +0000 Subject: Use glib's str functions (g_strlcat, g_strlcpy, g_snprintf, g_strdup_vprintf) git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1868 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 58340c42e..0f63ff1da 100644 --- a/src/utils.c +++ b/src/utils.c @@ -101,10 +101,11 @@ gcmp_list_from_path(mpdclient_t *c, gchar *path, GList *list, gint types) { mpd_Directory *dir = entity->info.directory; gchar *tmp = utf8_to_locale(dir->path); + gsize size = strlen(tmp)+2; - name = g_malloc(strlen(tmp)+2); - strcpy(name, tmp); - strcat(name, "/"); + name = g_malloc(size); + g_strlcpy(name, tmp, size); + g_strlcat(name, "/", size); g_free(tmp); } else if( entity && entity->type==MPD_INFO_ENTITY_TYPE_SONG && -- cgit v1.2.3