Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforce.net>2012-02-14 03:07:40 +0400
committerJustin Maggard <jmaggard@users.sourceforce.net>2012-02-14 03:07:40 +0400
commitcf8db09de07482aad3617b2934552b22b30203b1 (patch)
tree1e3cc818a80c7287d019bd22d3ec1fb78de55c04
parent85701d3a994f141aa05162b54f76dfd33c1eb6fc (diff)
* Properly escape double quotes.
-rw-r--r--upnpsoap.c27
-rw-r--r--utils.c3
2 files changed, 6 insertions, 24 deletions
diff --git a/upnpsoap.c b/upnpsoap.c
index e167e69..378bdbb 100644
--- a/upnpsoap.c
+++ b/upnpsoap.c
@@ -1392,20 +1392,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
args.flags |= FLAG_FREE_OBJECT_ID;
}
}
- #if 0 // Looks like the 360 already does this
- /* Sort by track number for some containers */
- if( orderBy &&
- ((strncmp(ContainerID, MUSIC_GENRE_ID, 3) == 0) ||
- (strncmp(ContainerID, MUSIC_ARTIST_ID, 3) == 0) ||
- (strncmp(ContainerID, MUSIC_ALBUM_ID, 3) == 0)) )
- {
- DPRINTF(E_DEBUG, L_HTTP, "Old sort order: %s\n", orderBy);
- sprintf(str_buf, "d.TRACK, ");
- memmove(orderBy+18, orderBy+9, strlen(orderBy)+1);
- memmove(orderBy+9, &str_buf, 9);
- DPRINTF(E_DEBUG, L_HTTP, "New sort order: %s\n", orderBy);
- }
- #endif
}
DPRINTF(E_DEBUG, L_HTTP, "Searching ContentDirectory:\n"
" * ObjectID: %s\n"
@@ -1432,7 +1418,6 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
SearchCriteria = modifyString(SearchCriteria, "&apos;", "'", 0);
SearchCriteria = modifyString(SearchCriteria, "&lt;", "<", 0);
SearchCriteria = modifyString(SearchCriteria, "&gt;", ">", 0);
- SearchCriteria = modifyString(SearchCriteria, "\\\"", "\"\"", 0);
SearchCriteria = modifyString(SearchCriteria, "object.", "", 0);
SearchCriteria = modifyString(SearchCriteria, "derivedfrom", "like", 1);
SearchCriteria = modifyString(SearchCriteria, "contains", "like", 2);
@@ -1458,16 +1443,12 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
newSearchCriteria = strdup(SearchCriteria);
SearchCriteria = newSearchCriteria = modifyString(newSearchCriteria, "res is ", "MIME is ", 0);
}
- #if 0 // Does 360 need this?
- if( strstr(SearchCriteria, "&amp;") )
+ if( strstr(SearchCriteria, "\\\"") )
{
- if( newSearchCriteria )
- newSearchCriteria = modifyString(newSearchCriteria, "&amp;", "&amp;amp;", 0);
- else
- newSearchCriteria = modifyString(strdup(SearchCriteria), "&amp;", "&amp;amp;", 0);
- SearchCriteria = newSearchCriteria;
+ if( !newSearchCriteria )
+ newSearchCriteria = strdup(SearchCriteria);
+ SearchCriteria = newSearchCriteria = modifyString(newSearchCriteria, "\\\"", "&amp;quot;", 0);
}
- #endif
}
DPRINTF(E_DEBUG, L_HTTP, "Translated SearchCriteria: %s\n", SearchCriteria);
diff --git a/utils.c b/utils.c
index cda4c3d..2c95587 100644
--- a/utils.c
+++ b/utils.c
@@ -182,12 +182,13 @@ escape_tag(const char *tag, int force_alloc)
{
char *esc_tag = NULL;
- if( strchr(tag, '&') || strchr(tag, '<') || strchr(tag, '>') )
+ if( strchr(tag, '&') || strchr(tag, '<') || strchr(tag, '>') || strchr(tag, '"') )
{
esc_tag = strdup(tag);
esc_tag = modifyString(esc_tag, "&", "&amp;amp;", 0);
esc_tag = modifyString(esc_tag, "<", "&amp;lt;", 0);
esc_tag = modifyString(esc_tag, ">", "&amp;gt;", 0);
+ esc_tag = modifyString(esc_tag, "\"", "&amp;quot;", 0);
}
else if( force_alloc )
esc_tag = strdup(tag);