/memcheck/tests/freebsd/stat
/memcheck/tests/freebsd/statfs
/memcheck/tests/freebsd/static_allocs
+/memcheck/tests/freebsd/strlcat_strlcpy
/memcheck/tests/freebsd/timerfd
/memcheck/tests/freebsd/timing_safe
/memcheck/tests/freebsd/utimens
475498 Add reallocarray wrapper
476320 Build failure with GCC
476535 Difference in allocation size for massif/tests/overloaded-new between clang++/libc++ and g++/libstdc++
+476780 Extend strlcat and strlcpy wrappers to GNU libc
476787 Build of Valgrind 3.21.0 fails when SOLARIS_PT_SUNDWTRACE_THRP is defined
To see details of a given bug, visit
pwritev2 \
rawmemchr \
readlinkat \
- reallocarray \
+ reallocarray \
semtimedop \
setcontext \
signalfd \
syscall \
utimensat \
mempcpy \
+ strlcat \
+ strlcpy \
stpncpy \
strchrnul \
memrchr \
[test x$ac_cv_func_reallocarray = xyes])
AM_CONDITIONAL([HAVE_WCSNCPY],
[test x$ac_cv_func_wcsncpy = xyes])
+AM_CONDITIONAL([HAVE_STRLCAT],
+ [test x$ac_cv_func_strlcat = xyes])
+AM_CONDITIONAL([HAVE_STRLCPY],
+ [test x$ac_cv_func_strlcpy = xyes])
if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
statfs.stderr.exp \
static_allocs.vgtest \
static_allocs.stderr.exp \
+ strlcat_strlcpy.vgtest \
+ strlcat_strlcpy.stderr.exp \
supponlyobj.vgtest \
supponlyobj.stderr.exp \
supponlyobj.supp \
stat \
statfs \
static_allocs \
+ strlcat_strlcpy \
timing_safe \
utimens \
utimes
--- /dev/null
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main(void)
+{
+ const size_t dstsize = 100U;
+ char *dst = malloc(dstsize);
+ // normal use
+ strlcpy(dst, "test1", dstsize);
+ assert(!strcmp(dst, "test1"));
+ strcat(dst, "test2");
+ // overlap, source starts within dst string
+ strlcpy(dst+4, dst+9, dstsize-4);
+ sprintf(dst, "test1test2");
+ // overlap, dst starts within src string
+ strlcpy(dst+9, dst+4, dstsize-9);
+ sprintf(dst, "test1");
+ // overlap, dst points to nul terminator of src
+ strlcpy(dst+5, dst+4, dstsize-5);
+ sprintf(dst, "test1");
+ // as above but incorrect length (1 too long)
+ // since src nul is overwritten this will
+ // keep reading from src until the length limit
+ // is reached
+ // since the length is wrong this will result
+ // in an invalid read and write 1 byte
+ // beyond the end of the buffer
+ strlcpy(dst+5, dst+4, dstsize-4);
+
+ sprintf(dst, "test1");
+ strlcat(dst, "test2", dstsize);
+ assert(!strcmp(dst, "test1test2"));
+
+ strlcat(dst+5, dst+7, dstsize-5);
+ sprintf(dst, "test1test2");
+ // we can't really control 'dst' since
+ // the destination id the end of the string
+ strlcat(dst+7, dst+5, dstsize-7);
+
+ // again wrong dstsize
+ sprintf(dst, "test1");
+ strlcpy(dst+3, dst+4, dstsize-2);
+ free(dst);
+}
+
--- /dev/null
+Source and destination overlap in strlcpy(0x........, 0x........, 96)
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:15)
+
+Source and destination overlap in strlcpy(0x........, 0x........, 91)
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:18)
+
+Source and destination overlap in strlcpy(0x........, 0x........, 95)
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:21)
+
+Source and destination overlap in strlcpy(0x........, 0x........, 96)
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:30)
+
+Invalid write of size 1
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:30)
+ Address 0x........ is 0 bytes after a block of size 100 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (strlcat_strlcpy.c:9)
+
+Invalid read of size 1
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:30)
+ Address 0x........ is 0 bytes after a block of size 100 alloc'd
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: main (strlcat_strlcpy.c:9)
+
+Source and destination overlap in strlcat(0x........, 0x........, 95)
+ at 0x........: strlcat (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:36)
+
+Source and destination overlap in strlcat(0x........, 0x........, 93)
+ at 0x........: strlcat (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:40)
+
+Source and destination overlap in strlcpy(0x........, 0x........, 98)
+ at 0x........: strlcpy (vg_replace_strmem.c:...)
+ by 0x........: main (strlcat_strlcpy.c:44)
+
--- /dev/null
+prog: strlcat_strlcpy
+vgopts: -q
+
}
#if defined(VGO_linux)
+ STRLCAT(VG_Z_LIBC_SONAME, strlcat)
#elif defined(VGO_freebsd)
STRLCAT(VG_Z_LD_ELF_SO_1, strlcat)
#if defined(VGO_linux)
-#if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android) \
- || defined(VGPV_mips32_linux_android)
#define STRLCPY_CHECK_FOR_DSTSIZE_ZERO
STRLCPY(VG_Z_LIBC_SONAME, strlcpy);
-#endif
#elif defined(VGO_freebsd)
#define STRLCPY_CHECK_FOR_DSTSIZE_ZERO