* Treat an empty Filter argument as "*".
* Make sure we allocate enough memory to hold SourceProtocolInfo response data.
This commit is contained in:
parent
40a37fbd78
commit
3ae378cdc9
@ -297,19 +297,16 @@ static void upnp_event_prepare(struct upnp_event_notify * obj)
|
||||
xml = NULL;
|
||||
l = 0;
|
||||
}
|
||||
obj->buffersize = 2048;
|
||||
obj->buffer = malloc(obj->buffersize);
|
||||
/*if(!obj->buffer) {
|
||||
}*/
|
||||
obj->tosend = snprintf(obj->buffer, obj->buffersize, notifymsg,
|
||||
obj->tosend = asprintf(&(obj->buffer), notifymsg,
|
||||
obj->path, obj->addrstr, obj->portstr, l+2,
|
||||
obj->sub->uuid, obj->sub->seq,
|
||||
l, xml);
|
||||
obj->buffersize = obj->tosend;
|
||||
if(xml) {
|
||||
free(xml);
|
||||
xml = NULL;
|
||||
}
|
||||
//DEBUG printf("Preparing buffer:\n%s\n", obj->buffer);
|
||||
DPRINTF(E_DEBUG, L_HTTP, "Sending UPnP Event response:\n%s\n", obj->buffer);
|
||||
obj->state = ESending;
|
||||
}
|
||||
|
||||
|
25
upnpsoap.c
25
upnpsoap.c
@ -112,11 +112,10 @@ GetProtocolInfo(struct upnphttp * h, const char * action)
|
||||
"<Sink></Sink>"
|
||||
"</u:%sResponse>";
|
||||
|
||||
|
||||
char body[1536];
|
||||
char * body;
|
||||
int bodylen;
|
||||
|
||||
bodylen = snprintf(body, sizeof(body), resp,
|
||||
bodylen = asprintf(&body, resp,
|
||||
action, "urn:schemas-upnp-org:service:ConnectionManager:1",
|
||||
action);
|
||||
BuildSendAndCloseSoapResp(h, body, bodylen);
|
||||
@ -431,7 +430,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||
memset(&args, 0, sizeof(args));
|
||||
strcpy(resp, resp0);
|
||||
/* See if we need to include DLNA namespace reference */
|
||||
if( (strlen(Filter) <= 1) || strstr(Filter, "dlna") )
|
||||
if( Filter && ((strlen(Filter) <= 1) || strstr(Filter, "dlna")) )
|
||||
strcat(resp, DLNA_NAMESPACE);
|
||||
strcat(resp, ">\n");
|
||||
|
||||
@ -460,13 +459,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
|
||||
ObjectId, RequestedCount, StartingIndex,
|
||||
BrowseFlag, Filter, SortCriteria);
|
||||
|
||||
if( !Filter )
|
||||
{
|
||||
ClearNameValueList(&data);
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
return;
|
||||
}
|
||||
if( strlen(Filter) > 1 )
|
||||
if( Filter && (strlen(Filter) > 1) )
|
||||
args.filter = Filter;
|
||||
|
||||
args.resp = resp;
|
||||
@ -566,17 +559,11 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
|
||||
|
||||
strcpy(resp, resp0);
|
||||
/* See if we need to include DLNA namespace reference */
|
||||
if( (strlen(Filter) <= 1) || strstr(Filter, "dlna") )
|
||||
if( Filter && ((strlen(Filter) <= 1) || strstr(Filter, "dlna")) )
|
||||
strcat(resp, DLNA_NAMESPACE);
|
||||
strcat(resp, ">\n");
|
||||
|
||||
if( !Filter )
|
||||
{
|
||||
ClearNameValueList(&data);
|
||||
SoapError(h, 402, "Invalid Args");
|
||||
return;
|
||||
}
|
||||
if( strlen(Filter) > 1 )
|
||||
if( Filter && (strlen(Filter) > 1) )
|
||||
args.filter = Filter;
|
||||
if( strcmp(ContainerID, "0") == 0 )
|
||||
*ContainerID = '*';
|
||||
|
Loading…
x
Reference in New Issue
Block a user