summaryrefslogtreecommitdiffstats
path: root/src/db-artwork-parser.c
diff options
context:
space:
mode:
authorJorg Schuler <jcsjcs@users.sourceforge.net>2007-06-01 13:56:32 +0000
committerJorg Schuler <jcsjcs@users.sourceforge.net>2007-06-01 13:56:32 +0000
commit0f0282ae958409f87b0da99d4f0664cee0d76afa (patch)
tree54443d4dd2134351da8c4cbfd998f68fea159a6b /src/db-artwork-parser.c
parent5596541efc1090ba11dc93f1236d4b7e9affc136 (diff)
downloadlibgpod-tmz-0f0282ae958409f87b0da99d4f0664cee0d76afa.tar.gz
libgpod-tmz-0f0282ae958409f87b0da99d4f0664cee0d76afa.tar.xz
libgpod-tmz-0f0282ae958409f87b0da99d4f0664cee0d76afa.zip
* src/db-artwork-parser.c (parse_mhba): non-zero terminated
string was copied using g_strdup() instead of g_strndup(). This affected album names of the Photo Database. src/db-artwork-writer.c (write_mhod_type_1): convert 'type' as 16 bit integer, not 32 bit integer. Potential problem on non-standard endian system (iPod side). src/db-itunes-parser.h: '#if 0' unused structure to avoid confusion. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1514 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/db-artwork-parser.c')
-rw-r--r--src/db-artwork-parser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c
index 7b84327..9d3c05d 100644
--- a/src/db-artwork-parser.c
+++ b/src/db-artwork-parser.c
@@ -355,15 +355,17 @@ parse_mhba (DBParseContext *ctx, GError *error)
mhod_ctx = db_parse_context_get_sub_context (ctx, cur_offset);
num_children = get_gint32 (mhba->num_mhods, ctx->byte_order);
while ((num_children > 0) && (mhod_ctx != NULL)) {
+ MhodHeaderArtworkType1 *mhod1;
/* FIXME: First mhod is album name, whats the others for? */
mhod = db_parse_context_get_m_header (mhod_ctx, ArtworkDB_MhodHeader, "mhod");
if (mhod == NULL) {
return -1;
}
db_parse_context_set_total_len (mhod_ctx, get_gint32(mhod->total_len, ctx->byte_order));
- album->name = g_strdup( (char *)((MhodHeaderArtworkType1*)mhod)->string );
+ mhod1 = (MhodHeaderArtworkType1*)mhod;
+ album->name = g_strndup ((gchar *)mhod1->string, mhod1->string_len);
cur_offset += mhod_ctx->total_len;
- dump_mhod_type_1 ((MhodHeaderArtworkType1*)mhod);
+ dump_mhod_type_1 (mhod1);
g_free (mhod_ctx);
num_children--;
}