Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/ssp/stpncpy_chk.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/ssp/stpncpy_chk.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- src/lib/libc/ssp/stpncpy_chk.c 2013/11/06 16:58:58 1.2 +++ src/lib/libc/ssp/stpncpy_chk.c 2015/05/09 15:42:21 1.3 @@ -1,4 +1,4 @@ -/* $NetBSD: stpncpy_chk.c,v 1.2 2013/11/06 16:58:58 christos Exp $ */ +/* $NetBSD: stpncpy_chk.c,v 1.3 2015/05/09 15:42:21 christos Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: stpncpy_chk.c,v 1.2 2013/11/06 16:58:58 christos Exp $"); +__RCSID("$NetBSD: stpncpy_chk.c,v 1.3 2015/05/09 15:42:21 christos Exp $"); /*LINTLIBRARY*/ @@ -49,5 +49,8 @@ __stpncpy_chk(char * __restrict dst, con if (len > slen) __chk_fail(); + if (__ssp_overlap(src, dst, len)) + __chk_fail(); + return stpncpy(dst, src, len); }