From 72e570186c4bed35ed3a53d0044125afec9b39bc Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 29 Jan 2013 22:54:55 +0100 Subject: [PATCH] upnphttp.c: Fix and comment the findendheaders() function --- miniupnpd/Changelog.txt | 8 +++++++- miniupnpd/upnphttp.c | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 6ad5f68..247a878 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,4 +1,10 @@ -$Id: Changelog.txt,v 1.320 2012/12/11 21:07:35 nanard Exp $ +$Id: Changelog.txt,v 1.322 2013/01/29 21:52:44 nanard Exp $ + +2013/01/29: + upnphttp.c: Fix and comment the findendheaders() function + +2013/01/27: + upnphttp.c: ParseHttpHeaders() now checks atoi() return 2012/12/11: More return value check for malloc() and realloc() diff --git a/miniupnpd/upnphttp.c b/miniupnpd/upnphttp.c index cebd210..6631d54 100644 --- a/miniupnpd/upnphttp.c +++ b/miniupnpd/upnphttp.c @@ -1,4 +1,4 @@ -/* $Id: upnphttp.c,v 1.82 2012/12/11 21:07:37 nanard Exp $ */ +/* $Id: upnphttp.c,v 1.85 2013/01/29 21:52:43 nanard Exp $ */ /* Project : miniupnp * Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author : Thomas Bernard @@ -253,10 +253,13 @@ Send501(struct upnphttp * h) SendRespAndClose_upnphttp(h); } +/* findendheaders() find the \r\n\r\n character sequence and + * return a pointer to it. + * It returns NULL if not found */ static const char * findendheaders(const char * s, int len) { - while(len-->0) + while(len-->3) { if(s[0]=='\r' && s[1]=='\n' && s[2]=='\r' && s[3]=='\n') return s;