Skip to content

Commit 79cca97

Browse files
committed
igd_desc_parse.c: fix buffer overflow
1 parent 1e7b234 commit 79cca97

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: miniupnpc/igd_desc_parse.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/* $Id: igd_desc_parse.c,v 1.16 2014/11/17 17:19:13 nanard Exp $ */
1+
/* $Id: igd_desc_parse.c,v 1.17 2015/09/15 13:30:04 nanard Exp $ */
22
/* Project : miniupnp
33
* http://miniupnp.free.fr/
44
* Author : Thomas Bernard
5-
* Copyright (c) 2005-2014 Thomas Bernard
5+
* Copyright (c) 2005-2015 Thomas Bernard
66
* This software is subject to the conditions detailed in the
77
* LICENCE file provided in this distribution. */
88

@@ -15,7 +15,9 @@
1515
void IGDstartelt(void * d, const char * name, int l)
1616
{
1717
struct IGDdatas * datas = (struct IGDdatas *)d;
18-
memcpy( datas->cureltname, name, l);
18+
if(l >= MINIUPNPC_URL_MAXSIZE)
19+
l = MINIUPNPC_URL_MAXSIZE-1;
20+
memcpy(datas->cureltname, name, l);
1921
datas->cureltname[l] = '\0';
2022
datas->level++;
2123
if( (l==7) && !memcmp(name, "service", l) ) {

0 commit comments

Comments
 (0)