From: Tom Hughes Date: Mon, 18 Jul 2005 22:45:55 +0000 (+0000) Subject: Check each member of the ifconf structure passed to SIOCGIFCONF X-Git-Tag: svn/VALGRIND_3_0_0~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ada7c716a11193ce89df1605bcd3fd4884a84bbd;p=thirdparty%2Fvalgrind.git Check each member of the ifconf structure passed to SIOCGIFCONF individually to avoid problems with padding bytes on 64 bit platforms. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4167 --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 6163552c68..d3b02d4b18 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3257,7 +3257,12 @@ PRE(sys_ioctl) if (!VG_(is_kerror)(RES) && RES == 0) POST_MEM_WRITE(ARG3, sizeof(struct ifconf)); */ - PRE_MEM_READ( "ioctl(SIOCGIFCONF)", ARG3, sizeof(struct vki_ifconf)); + PRE_MEM_READ( "ioctl(SIOCGIFCONF)", + (Addr)&((struct vki_ifconf *)ARG3)->ifc_len, + sizeof(((struct vki_ifconf *)ARG3)->ifc_len)); + PRE_MEM_READ( "ioctl(SIOCGIFCONF)", + (Addr)&((struct vki_ifconf *)ARG3)->vki_ifc_buf, + sizeof(((struct vki_ifconf *)ARG3)->vki_ifc_buf)); if ( ARG3 ) { // TODO len must be readable and writable // buf pointer only needs to be readable