From b7a4f8d6961d37a1c84742ad02124af7cec4ffc1 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 3 Feb 2014 11:28:31 +0100 Subject: [PATCH] minixml.c: now handle XML comments --- miniupnpc/Changelog.txt | 3 +++ miniupnpc/minixml.c | 19 ++++++++++++++++--- miniupnpd/Changelog.txt | 1 + miniupnpd/minixml.c | 19 ++++++++++++++++--- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/miniupnpc/Changelog.txt b/miniupnpc/Changelog.txt index 180015a..ccf3b91 100644 --- a/miniupnpc/Changelog.txt +++ b/miniupnpc/Changelog.txt @@ -1,6 +1,9 @@ $Id: Changelog.txt,v 1.191 2014/01/31 13:18:24 nanard Exp $ miniUPnP client Changelog. +2014/02/03: + minixml now handle XML comments + VERSION 1.9 : released 2014/01/31 2014/01/31: diff --git a/miniupnpc/minixml.c b/miniupnpc/minixml.c index d3f7d06..1f22273 100644 --- a/miniupnpc/minixml.c +++ b/miniupnpc/minixml.c @@ -1,10 +1,10 @@ -/* $Id: minixml.c,v 1.9 2011/02/07 13:44:57 nanard Exp $ */ +/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */ /* minixml.c : the minimum size a xml parser can be ! */ /* Project : miniupnp * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author : Thomas Bernard -Copyright (c) 2005-2011, Thomas BERNARD +Copyright (c) 2005-2014, Thomas BERNARD All rights reserved. Redistribution and use in source and binary forms, with or without @@ -113,7 +113,20 @@ static void parseelt(struct xmlparser * p) const char * elementname; while(p->xml < (p->xmlend - 1)) { - if((p->xml)[0]=='<' && (p->xml)[1]!='?') + if((p->xml + 4) <= p->xmlend && (0 == memcmp(p->xml, "", 3) != 0); + p->xml += 3; + } + else if((p->xml)[0]=='<' && (p->xml)[1]!='?') { i = 0; elementname = ++p->xml; while( !IS_WHITE_SPACE(*p->xml) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 9683ace..517b83e 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -2,6 +2,7 @@ $Id: Changelog.txt,v 1.348 2014/02/03 09:32:09 nanard Exp $ 2014/02/03: PCP : Add support for ANNOUNCE requests + minixml now handle XML comments 2013/12/16: Attempt to compile with OS X/pf diff --git a/miniupnpd/minixml.c b/miniupnpd/minixml.c index d3f7d06..1f22273 100644 --- a/miniupnpd/minixml.c +++ b/miniupnpd/minixml.c @@ -1,10 +1,10 @@ -/* $Id: minixml.c,v 1.9 2011/02/07 13:44:57 nanard Exp $ */ +/* $Id: minixml.c,v 1.10 2012/03/05 19:42:47 nanard Exp $ */ /* minixml.c : the minimum size a xml parser can be ! */ /* Project : miniupnp * webpage: http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author : Thomas Bernard -Copyright (c) 2005-2011, Thomas BERNARD +Copyright (c) 2005-2014, Thomas BERNARD All rights reserved. Redistribution and use in source and binary forms, with or without @@ -113,7 +113,20 @@ static void parseelt(struct xmlparser * p) const char * elementname; while(p->xml < (p->xmlend - 1)) { - if((p->xml)[0]=='<' && (p->xml)[1]!='?') + if((p->xml + 4) <= p->xmlend && (0 == memcmp(p->xml, "", 3) != 0); + p->xml += 3; + } + else if((p->xml)[0]=='<' && (p->xml)[1]!='?') { i = 0; elementname = ++p->xml; while( !IS_WHITE_SPACE(*p->xml)