From 95b2e7519e3b4a2129c16f2aa72fbd08f8c13fc7 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 31 Jan 2010 02:07:23 +0000 Subject: [PATCH] - Merge some small changes from aicom-network-branch to fix potential memory corruption and remove unused code in oskittcp - Add a hack to WSHSetSocketInformation so we don't fail with options that aren't implemented yet - Fixes bug #5131 svn path=/trunk/; revision=45356 --- reactos/dll/win32/wshtcpip/wshtcpip.c | 4 ++- .../include/freebsd/src/sys/sys/mbuf.h | 28 ------------------- .../drivers/oskittcp/include/oskitfreebsd.h | 2 +- .../lib/drivers/oskittcp/oskittcp/uipc_mbuf.c | 6 ---- 4 files changed, 4 insertions(+), 36 deletions(-) diff --git a/reactos/dll/win32/wshtcpip/wshtcpip.c b/reactos/dll/win32/wshtcpip/wshtcpip.c index c585128adfb..65d7cb0055a 100644 --- a/reactos/dll/win32/wshtcpip/wshtcpip.c +++ b/reactos/dll/win32/wshtcpip/wshtcpip.c @@ -623,8 +623,10 @@ WSHSetSocketInformation( /* FIXME: We only handle address file object here */ RealOptionName = GetAddressOption(Level, OptionName); + + /* FIXME: Support all options */ if (!RealOptionName) - return WSAEINVAL; + return 0; /* return WSAEINVAL; */ Info = HeapAlloc(GetProcessHeap(), 0, sizeof(*Info) + OptionLength); if (!Info) diff --git a/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h b/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h index b3226e9155e..7a6b0f07f19 100644 --- a/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h +++ b/reactos/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h @@ -57,13 +57,6 @@ #include #endif -#ifndef OSKIT -#ifdef __REACTOS__ -/* #define OSKIT */ -#define LOCAL_OSKIT_DEFINED -#endif -#endif - /* * Mbufs are of a single size, MSIZE (machine/machparam.h), which * includes overhead. An mbuf may add a single "mbuf cluster" of size @@ -301,21 +294,6 @@ union mcluster { } \ ) -#ifdef __REACTOS__ -#define MCLGET(m, how) { \ - OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \ - (m)->m_ext.ext_buf = malloc(MCLBYTES,__FILE__,__LINE__); \ - if ((m)->m_ext.ext_buf != NULL) { \ - (m)->m_data = (m)->m_ext.ext_buf; \ - (m)->m_flags |= M_EXT; \ - (m)->m_ext.ext_size = MCLBYTES; \ - } \ - } - -#define MCLFREE(p) { \ - free( (p), 0 ); \ - } -#else #define MCLGET(m, how) \ { MCLALLOC((m)->m_ext.ext_buf, (how)); \ OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \ @@ -335,7 +313,6 @@ union mcluster { mbstat.m_clfree++; \ } \ ) -#endif #else #define MCLGET(m, how) \ { (m)->m_ext.ext_bufio = oskit_bufio_create(MCLBYTES); \ @@ -557,9 +534,4 @@ int mbtypes[] = { /* XXX */ #endif #endif -#ifdef LOCAL_OSKIT_DEFINED -#undef LOCAL_OSKIT_DEFINED -#undef OSKIT -#endif - #endif /* !_SYS_MBUF_H_ */ diff --git a/reactos/lib/drivers/oskittcp/include/oskitfreebsd.h b/reactos/lib/drivers/oskittcp/include/oskitfreebsd.h index 354e7e6db8d..f7d48504d5f 100644 --- a/reactos/lib/drivers/oskittcp/include/oskitfreebsd.h +++ b/reactos/lib/drivers/oskittcp/include/oskitfreebsd.h @@ -14,7 +14,7 @@ extern void oskittcp_die(const char *file, int line); #define printf DbgPrint #define vprintf DbgVPrint -#define ovbcopy(x,y,z) bcopy(x,y,z) +#define ovbcopy(src,dst,n) memmove(dst,src,n) #define bzero(x,y) memset(x,0,y) #define bcopy(src,dst,n) memcpy(dst,src,n) #ifdef _MSC_VER diff --git a/reactos/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c b/reactos/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c index e05d4ee6101..ee86ffc4889 100644 --- a/reactos/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c +++ b/reactos/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c @@ -365,9 +365,7 @@ m_copym(m, off0, len, wait) #ifdef OSKIT oskit_bufio_addref(m->m_ext.ext_bufio); #else -#ifndef __REACTOS__ mclrefcnt[mtocl(m->m_ext.ext_buf)]++; -#endif #endif /* OSKIT */ n->m_ext = m->m_ext; n->m_flags |= M_EXT; @@ -729,11 +727,7 @@ m_devget(buf, totlen, off0, ifp, copy) if (copy) copy(cp, mtod(m, caddr_t), (unsigned)len); else -#ifdef __REACTOS__ - memcpy(mtod(m, caddr_t), cp, len); -#else bcopy(cp, mtod(m, caddr_t), (unsigned)len); -#endif cp += len; *mp = m; mp = &m->m_next;