diff --git a/miniupnpc/miniwget.c b/miniupnpc/miniwget.c index 5c135f4..618d4b7 100644 --- a/miniupnpc/miniwget.c +++ b/miniupnpc/miniwget.c @@ -1,8 +1,8 @@ -/* $Id: miniwget.c,v 1.78 2018/03/13 23:22:18 nanard Exp $ */ +/* $Id: miniwget.c,v 1.82 2020/05/29 21:14:22 nanard Exp $ */ /* Project : miniupnp - * Website : http://miniupnp.free.fr/ + * Website : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * Author : Thomas Bernard - * Copyright (c) 2005-2018 Thomas Bernard + * Copyright (c) 2005-2020 Thomas Bernard * This software is subject to the conditions detailed in the * LICENCE file provided in this distribution. */ @@ -176,11 +176,14 @@ getHTTPResponse(SOCKET s, int * size, int * status_code) /* Status line * HTTP-Version SP Status-Code SP Reason-Phrase CRLF */ int sp; - for(sp = 0; sp < i; sp++) + for(sp = 0; sp < i - 1; sp++) if(header_buf[sp] == ' ') { if(*status_code < 0) - *status_code = atoi(header_buf + sp + 1); + { + if (header_buf[sp+1] >= '1' && header_buf[sp+1] <= '9') + *status_code = atoi(header_buf + sp + 1); + } else { #ifdef DEBUG