diff --git a/devel/upnp/Makefile b/devel/upnp/Makefile index 46d9ca01de84..5fb745763a77 100644 --- a/devel/upnp/Makefile +++ b/devel/upnp/Makefile @@ -7,6 +7,7 @@ PORTNAME= upnp PORTVERSION= 1.6.8 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= devel MASTER_SITES= SF/p${PORTNAME}/p${PORTNAME}/libUPnP%20${PORTVERSION} @@ -38,4 +39,11 @@ post-patch: .SILENT ${REINPLACE_CMD} '/^pkgconfigexecdir/s|$$(libdir)|$$(prefix)/libdata|' \ ${WRKSRC}/Makefile.in -.include +.include + +# strndup(3) was added in 7.2-RELEASE +.if ${OSVERSION} < 702000 +EXTRA_PATCHES+= ${FILESDIR}/extra-upnp-src-api-UpnpString.c +.endif + +.include diff --git a/devel/upnp/files/extra-upnp-src-api-UpnpString.c b/devel/upnp/files/extra-upnp-src-api-UpnpString.c new file mode 100644 index 000000000000..94c2b2265d29 --- /dev/null +++ b/devel/upnp/files/extra-upnp-src-api-UpnpString.c @@ -0,0 +1,14 @@ +--- upnp/src/api/UpnpString.c.orig 2010-10-26 21:46:15.000000000 +0200 ++++ upnp/src/api/UpnpString.c 2010-10-26 21:51:47.000000000 +0200 +@@ -165,8 +165,10 @@ + + int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n) + { +- char *q = strndup(s, n); ++ char *q = malloc(n+1); + if (!q) goto error_handler1; ++ strncpy(q, s, n); ++ q[n-1] = '\0'; + free(((struct SUpnpString *)p)->m_string); + ((struct SUpnpString *)p)->m_length = strlen(q); + ((struct SUpnpString *)p)->m_string = q;