Module Name: src Committed By: christos Date: Sun Apr 6 01:01:49 UTC 2014
Modified Files: src/lib/libc/ssp: stpcpy_chk.c Log Message: fix off by one in stpcpy_chk. christos To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/ssp/stpcpy_chk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/ssp/stpcpy_chk.c diff -u src/lib/libc/ssp/stpcpy_chk.c:1.2 src/lib/libc/ssp/stpcpy_chk.c:1.3 --- src/lib/libc/ssp/stpcpy_chk.c:1.2 Wed Nov 6 11:58:58 2013 +++ src/lib/libc/ssp/stpcpy_chk.c Sat Apr 5 21:01:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: stpcpy_chk.c,v 1.2 2013/11/06 16:58:58 christos Exp $ */ +/* $NetBSD: stpcpy_chk.c,v 1.3 2014/04/06 01:01:49 christos Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: stpcpy_chk.c,v 1.2 2013/11/06 16:58:58 christos Exp $"); +__RCSID("$NetBSD: stpcpy_chk.c,v 1.3 2014/04/06 01:01:49 christos Exp $"); /*LINTLIBRARY*/ @@ -45,11 +45,11 @@ char *__stpcpy_chk(char * __restrict, co char * __stpcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen) { - size_t len = strlen(src) + 1; + size_t len = strlen(src); if (len > slen) __chk_fail(); - (void)memcpy(dst, src, len); + (void)memcpy(dst, src, len + 1); return dst + len; }