update upnpreplyparse to allow larger values (128 chars instead of 64)

also add testcase
This commit is contained in:
Thomas Bernard 2013-06-06 23:41:23 +02:00
parent 74c3c18380
commit 63ece30b87
8 changed files with 22 additions and 14 deletions

View File

@ -1,6 +1,9 @@
$Id: Changelog.txt,v 1.186 2013/05/14 20:37:35 nanard Exp $
$Id: Changelog.txt,v 1.187 2013/06/06 21:36:39 nanard Exp $
miniUPnP client Changelog.
2013/06/06:
update upnpreplyparse to allow larger values (128 chars instead of 64)
2013/05/14:
Update upnpreplyparse to take into account "empty" elements
validate upnpreplyparse.c code with "make check"

View File

@ -0,0 +1 @@
NewDefaultConnectionService=uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SetDefaultConnectionService xmlns:u="urn:schemas-upnp-org:service:Layer3Forwarding:1"><NewDefaultConnectionService>uuid:c6c05a33-f704-48df-9910-e099b3471d81:WANConnectionDevice:1,INVALID_SERVICE_ID</NewDefaultConnectionService></u:SetDefaultConnectionService></s:Body></s:Envelope>

View File

@ -1,4 +1,4 @@
/* $Id: upnpreplyparse.c,v 1.14 2013/05/14 19:53:54 nanard Exp $ */
/* $Id: upnpreplyparse.c,v 1.15 2013/06/06 21:36:40 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -37,11 +37,11 @@ NameValueParserEndElt(void * d, const char * name, int l)
if(strcmp(data->curelt, "NewPortListing") != 0)
{
int l;
/* standard case. Limited to 63 chars strings */
/* standard case. Limited to n chars strings */
l = data->cdatalen;
nv = malloc(sizeof(struct NameValue));
if(l>63)
l = 63;
if(l>=(int)sizeof(nv->value))
l = sizeof(nv->value) - 1;
strncpy(nv->name, data->curelt, 64);
nv->name[63] = '\0';
if(data->cdata != NULL)

View File

@ -1,4 +1,4 @@
/* $Id: upnpreplyparse.h,v 1.16 2013/05/14 20:37:13 nanard Exp $ */
/* $Id: upnpreplyparse.h,v 1.17 2013/06/06 21:36:40 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -21,7 +21,7 @@ extern "C" {
struct NameValue {
LIST_ENTRY(NameValue) entries;
char name[64];
char value[64];
char value[128];
};
struct NameValueParserData {

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.343 2013/06/05 09:18:22 nanard Exp $
$Id: Changelog.txt,v 1.344 2013/06/06 21:39:58 nanard Exp $
2013/06/06:
update upnpreplyparse to allow larger values (128 chars instead of 64)
2013/06/05:
check Service ID in SetDefaultConnectionService method

View File

@ -1,4 +1,4 @@
/* $Id: upnpreplyparse.c,v 1.14 2013/05/14 19:53:54 nanard Exp $ */
/* $Id: upnpreplyparse.c,v 1.15 2013/06/06 21:36:40 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -37,11 +37,11 @@ NameValueParserEndElt(void * d, const char * name, int l)
if(strcmp(data->curelt, "NewPortListing") != 0)
{
int l;
/* standard case. Limited to 63 chars strings */
/* standard case. Limited to n chars strings */
l = data->cdatalen;
nv = malloc(sizeof(struct NameValue));
if(l>63)
l = 63;
if(l>=(int)sizeof(nv->value))
l = sizeof(nv->value) - 1;
strncpy(nv->name, data->curelt, 64);
nv->name[63] = '\0';
if(data->cdata != NULL)

View File

@ -1,4 +1,4 @@
/* $Id: upnpreplyparse.h,v 1.16 2013/05/14 20:37:13 nanard Exp $ */
/* $Id: upnpreplyparse.h,v 1.17 2013/06/06 21:36:40 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -21,7 +21,7 @@ extern "C" {
struct NameValue {
LIST_ENTRY(NameValue) entries;
char name[64];
char value[64];
char value[128];
};
struct NameValueParserData {