ensure SSDP reply headers are not partial matches

This commit is contained in:
Cameron Gutman 2019-01-05 12:24:46 -08:00
parent 86030db849
commit aaa0ed8c86
4 changed files with 9 additions and 9 deletions

View File

@ -102,10 +102,10 @@ parse_msearch_reply(const char * reply, int size,
if(b!=0) { if(b!=0) {
/* skip the colon and white spaces */ /* skip the colon and white spaces */
do { b++; } while(reply[b]==' ' && b<size); do { b++; } while(reply[b]==' ' && b<size);
if(0==strncasecmp(reply+a, "location", 8)) { if(0==strncasecmp(reply+a, "location:", 9)) {
*location = reply+b; *location = reply+b;
*locationsize = i-b; *locationsize = i-b;
} else if(0==strncasecmp(reply+a, "st", 2)) { } else if(0==strncasecmp(reply+a, "st:", 3)) {
*st = reply+b; *st = reply+b;
*stsize = i-b; *stsize = i-b;
} }

View File

@ -57,12 +57,12 @@ parseMSEARCHReply(const char * reply, int size,
} }
putchar('\n');*/ putchar('\n');*/
do { b++; } while(reply[b]==' '); do { b++; } while(reply[b]==' ');
if(0==strncasecmp(reply+a, "location", 8)) if(0==strncasecmp(reply+a, "location:", 9))
{ {
*location = reply+b; *location = reply+b;
*locationsize = i-b; *locationsize = i-b;
} }
else if(0==strncasecmp(reply+a, "st", 2)) else if(0==strncasecmp(reply+a, "st:", 3))
{ {
*st = reply+b; *st = reply+b;
*stsize = i-b; *stsize = i-b;

View File

@ -123,10 +123,10 @@ parse_msearch_reply(const char * reply, int size,
if(b!=0) { if(b!=0) {
/* skip the colon and white spaces */ /* skip the colon and white spaces */
do { b++; } while(reply[b]==' ' && b<i); do { b++; } while(reply[b]==' ' && b<i);
if(0==strncasecmp(reply+a, "location", 8)) { if(0==strncasecmp(reply+a, "location:", 9)) {
*location = reply+b; *location = reply+b;
*locationsize = i-b; *locationsize = i-b;
} else if(0==strncasecmp(reply+a, "st", 2)) { } else if(0==strncasecmp(reply+a, "st:", 3)) {
*st = reply+b; *st = reply+b;
*stsize = i-b; *stsize = i-b;
} }

View File

@ -418,17 +418,17 @@ parseMSEARCHReply(const char * reply, int size,
putchar('\n');*/ putchar('\n');*/
/* skip the colon and white spaces */ /* skip the colon and white spaces */
do { b++; } while(reply[b]==' '); do { b++; } while(reply[b]==' ');
if(0==strncasecmp(reply+a, "location", 8)) if(0==strncasecmp(reply+a, "location:", 9))
{ {
*location = reply+b; *location = reply+b;
*locationsize = i-b; *locationsize = i-b;
} }
else if(0==strncasecmp(reply+a, "st", 2)) else if(0==strncasecmp(reply+a, "st:", 3))
{ {
*st = reply+b; *st = reply+b;
*stsize = i-b; *stsize = i-b;
} }
else if(0==strncasecmp(reply+a, "usn", 3)) else if(0==strncasecmp(reply+a, "usn:", 4))
{ {
*usn = reply+b; *usn = reply+b;
*usnsize = i-b; *usnsize = i-b;