Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/ssp simplify



details:   https://anonhg.NetBSD.org/src/rev/f28fd26344fe
branches:  trunk
changeset: 791133:f28fd26344fe
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 06 16:30:27 2013 +0000

description:
simplify

diffstat:

 lib/libc/ssp/strcpy_chk.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 0acc491007a5 -r f28fd26344fe lib/libc/ssp/strcpy_chk.c
--- a/lib/libc/ssp/strcpy_chk.c Wed Nov 06 14:53:29 2013 +0000
+++ b/lib/libc/ssp/strcpy_chk.c Wed Nov 06 16:30:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strcpy_chk.c,v 1.5 2010/12/28 16:19:25 christos Exp $  */
+/*     $NetBSD: strcpy_chk.c,v 1.6 2013/11/06 16:30:27 christos Exp $  */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: strcpy_chk.c,v 1.5 2010/12/28 16:19:25 christos Exp $");
+__RCSID("$NetBSD: strcpy_chk.c,v 1.6 2013/11/06 16:30:27 christos Exp $");
 
 /*LINTLIBRARY*/
 
@@ -41,10 +41,10 @@
 char *
 __strcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen)
 {
-       size_t len = strlen(src);
+       size_t len = strlen(src) + 1;
 
-       if (len >= slen)
+       if (len > slen)
                __chk_fail();
 
-       return memcpy(dst, src, len + 1);
+       return memcpy(dst, src, len);
 }



Home | Main Index | Thread Index | Old Index