From 4daad1291e1ef2dd5e243d714427bdc63c8102df Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Tue, 3 May 2011 06:14:25 +0000 Subject: [PATCH] * Fix a potential crash during parsing of SSDP alive packets. --- minissdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 */