igd_desc_parse.c: fix buffer overflow
This commit is contained in:
parent
79cca974a4
commit
2f5cc79033
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: igd_desc_parse.c,v 1.16 2014/11/17 17:19:13 nanard Exp $ */
|
/* $Id: igd_desc_parse.c,v 1.17 2015/09/15 13:30:04 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* http://miniupnp.free.fr/
|
* http://miniupnp.free.fr/
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2014 Thomas Bernard
|
* Copyright (c) 2005-2015 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
void IGDstartelt(void * d, const char * name, int l)
|
void IGDstartelt(void * d, const char * name, int l)
|
||||||
{
|
{
|
||||||
struct IGDdatas * datas = (struct IGDdatas *)d;
|
struct IGDdatas * datas = (struct IGDdatas *)d;
|
||||||
|
if(l >= MINIUPNPC_URL_MAXSIZE)
|
||||||
|
l = MINIUPNPC_URL_MAXSIZE-1;
|
||||||
memcpy(datas->cureltname, name, l);
|
memcpy(datas->cureltname, name, l);
|
||||||
datas->cureltname[l] = '\0';
|
datas->cureltname[l] = '\0';
|
||||||
datas->level++;
|
datas->level++;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: igd_desc_parse.c,v 1.16 2014/11/17 17:19:13 nanard Exp $ */
|
/* $Id: igd_desc_parse.c,v 1.17 2015/09/15 13:30:04 nanard Exp $ */
|
||||||
/* Project : miniupnp
|
/* Project : miniupnp
|
||||||
* http://miniupnp.free.fr/
|
* http://miniupnp.free.fr/
|
||||||
* Author : Thomas Bernard
|
* Author : Thomas Bernard
|
||||||
* Copyright (c) 2005-2014 Thomas Bernard
|
* Copyright (c) 2005-2015 Thomas Bernard
|
||||||
* This software is subject to the conditions detailed in the
|
* This software is subject to the conditions detailed in the
|
||||||
* LICENCE file provided in this distribution. */
|
* LICENCE file provided in this distribution. */
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
void IGDstartelt(void * d, const char * name, int l)
|
void IGDstartelt(void * d, const char * name, int l)
|
||||||
{
|
{
|
||||||
struct IGDdatas * datas = (struct IGDdatas *)d;
|
struct IGDdatas * datas = (struct IGDdatas *)d;
|
||||||
|
if(l >= MINIUPNPC_URL_MAXSIZE)
|
||||||
|
l = MINIUPNPC_URL_MAXSIZE-1;
|
||||||
memcpy(datas->cureltname, name, l);
|
memcpy(datas->cureltname, name, l);
|
||||||
datas->cureltname[l] = '\0';
|
datas->cureltname[l] = '\0';
|
||||||
datas->level++;
|
datas->level++;
|
||||||
|
|
Loading…
Reference in New Issue