1) Protect against uninitialised fl in daap_sort_build and 2) Don't

add blank items in daap group reply
This commit is contained in:
ejurgensen 2013-12-12 23:27:50 +01:00
parent a4f9920a09
commit d1a51ef45d

View File

@ -394,6 +394,8 @@ daap_sort_build(struct sort_ctx *ctx, char *str)
char fl;
len = strlen(str);
if (len > 0)
{
ret = u8_normalize(UNINORM_NFD, (uint8_t *)str, len, NULL, &len);
if (!ret)
{
@ -404,6 +406,9 @@ daap_sort_build(struct sort_ctx *ctx, char *str)
fl = ret[0];
free(ret);
}
else
fl = 0;
if (isascii(fl) && isalpha(fl))
{
@ -1634,6 +1639,10 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri
ngrp = 0;
while ((ret = db_query_fetch_group(&qp, &dbgri)) == 0)
{
/* Don't add item if no name (eg blank album name) */
if (strlen(dbgri.itemname) == 0)
continue;
ngrp++;
for (i = 0; i < nmeta; i++)