From 8960e023e90691fd0299fabb81222013782d9008 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Thu, 17 Feb 2011 09:21:14 +0000 Subject: [PATCH] * Fix a potential buffer overflow with Xbox360 clients. --- upnphttp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upnphttp.c b/upnphttp.c index ecdb925..87b3e40 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -797,9 +797,10 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h) /* If it's a Xbox360, we might need a special friendly_name to be recognized */ if( (h->req_client == EXbox) && !strchr(friendly_name, ':') ) { - strncat(friendly_name, ": 1", FRIENDLYNAME_MAX_LEN-4); + i = strlen(friendly_name); + snprintf(friendly_name+i, FRIENDLYNAME_MAX_LEN-i, ": 1"); sendXMLdesc(h, genRootDesc); - friendly_name[strlen(friendly_name)-3] = '\0'; + friendly_name[i] = '\0'; } else {