diff --git a/minissdp.c b/minissdp.c index a3d7d90..bfcb090 100644 --- a/minissdp.c +++ b/minissdp.c @@ -532,6 +532,7 @@ ProcessSSDPRequest(int s, unsigned short port) loc_len = 0; while(*loc == ' ' || *loc == '\t') loc++; while(loc[loc_len]!='\r' && loc[loc_len]!='\n') loc_len++; + loc[loc_len] = '\0'; } else if(strncasecmp(bufr+i, "NTS:", 4) == 0) { @@ -541,11 +542,10 @@ ProcessSSDPRequest(int s, unsigned short port) while(man[man_len]!='\r' && man[man_len]!='\n') man_len++; } } - if (!man || (strncmp(man, "ssdp:alive", man_len) != 0)) + if (!loc || !srv || !man || (strncmp(man, "ssdp:alive", man_len) != 0)) { return; } - loc[loc_len] = '\0'; if (strncmp(srv, "Allegro-Software-RomPlug", 24) == 0) { /* Check if the client is already in cache */