From 10e4a138a38e654c5a4e2825953bece975cfa945 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Mon, 2 Dec 2013 20:55:16 +0100 Subject: [PATCH] Fix crash after special (malformed?) TunesRemote SE daap request Request has comma before &query: /databases/1/containers/1/items?session-id=100&meta=dmap.itemname,[...],daap.songcompilation,&query=('com.apple... --- src/dmap_common.c | 5 ++++- src/httpd_daap.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dmap_common.c b/src/dmap_common.c index 421b74cb..f6790bb0 100644 --- a/src/dmap_common.c +++ b/src/dmap_common.c @@ -410,7 +410,10 @@ dmap_encode_file_metadata(struct evbuffer *songlist, struct evbuffer *song, stru break; df = meta[i]; - dfm = df->dfm; + if (df->dfm) + dfm = df->dfm; + else + break; } /* No specific meta tags requested, send out everything */ else diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 96510814..92a0ee24 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -585,7 +585,7 @@ parse_meta(struct evhttp_request *req, char *tag, const char *param, const struc nmeta = 1; ptr = metastr; - while ((ptr = strchr(ptr + 1, ','))) + while ((ptr = strchr(ptr + 1, ',')) && (strlen(ptr) > 1)) nmeta++; DPRINTF(E_DBG, L_DAAP, "Asking for %d meta tags\n", nmeta);