upnpsoap.c: fix ExecuteSoapAction

do not use strchr() to locate the " character at the end of the
string.

fixes #675
This commit is contained in:
Thomas Bernard 2023-12-29 18:24:50 +01:00
parent 84cd9e6289
commit 5380a08693
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF

View File

@ -2344,7 +2344,6 @@ void
ExecuteSoapAction(struct upnphttp * h, const char * action, int n)
{
char * p;
char * p2;
int i, len, methodlen;
char namespace[256];
@ -2356,11 +2355,10 @@ ExecuteSoapAction(struct upnphttp * h, const char * action, int n)
namespace[i] = action[i];
namespace[i] = '\0';
p++;
p2 = strchr(p, '"');
if(p2 && (p2 - action) <= n)
methodlen = p2 - p;
else
methodlen = n - (p - action);
methodlen = n - (int)(p - action);
if(p[methodlen-1] == '"') {
methodlen--; /* remove the ending " */
}
/*syslog(LOG_DEBUG, "SoapMethod: %.*s %d %d %p %p %d",
methodlen, p, methodlen, n, action, p, (int)(p - action));*/
for(i = 0; soapMethods[i].methodName; i++) {