diff --git a/upnpsoap.c b/upnpsoap.c index 6fa5fc0..ca44d2a 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -1122,7 +1122,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action) SearchCriteria = modifyString(SearchCriteria, "'", "'", 0); SearchCriteria = modifyString(SearchCriteria, "object.", "", 0); SearchCriteria = modifyString(SearchCriteria, "derivedfrom", "glob", 1); - SearchCriteria = modifyString(SearchCriteria, "contains", "glob", 1); + SearchCriteria = modifyString(SearchCriteria, "contains", "glob", 2); SearchCriteria = modifyString(SearchCriteria, "dc:title", "d.TITLE", 0); SearchCriteria = modifyString(SearchCriteria, "dc:creator", "d.CREATOR", 0); SearchCriteria = modifyString(SearchCriteria, "upnp:class", "o.CLASS", 0); diff --git a/utils.c b/utils.c index 879d9bf..c199d19 100644 --- a/utils.c +++ b/utils.c @@ -89,7 +89,7 @@ modifyString(char * string, const char * before, const char * after, short like) oldlen = strlen(before); newlen = strlen(after); - if( newlen > oldlen ) + if( newlen+like > oldlen ) { s = string; while( (p = strstr(s, before)) ) @@ -114,10 +114,17 @@ modifyString(char * string, const char * before, const char * after, short like) while( isspace(*t) ) t++; if( *t == '"' ) + { + if( like == 2 ) + { + memmove(t+2, t+1, strlen(t+1)+1); + *++t = '*'; + } while( *++t != '"' ) continue; - memmove(t+1, t, strlen(t)+1); - *t = '*'; + memmove(t+1, t, strlen(t)+1); + *t = '*'; + } } s = p + newlen; }