Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/string Using bcopy/memcpy with NULL argument...



details:   https://anonhg.NetBSD.org/src/rev/e9652f381421
branches:  trunk
changeset: 795466:e9652f381421
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Apr 14 18:18:58 2014 +0000

description:
Using bcopy/memcpy with NULL arguments is valid as long as the size is
also 0.

diffstat:

 common/lib/libc/string/bcopy.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 58d27d4c3627 -r e9652f381421 common/lib/libc/string/bcopy.c
--- a/common/lib/libc/string/bcopy.c    Mon Apr 14 18:15:17 2014 +0000
+++ b/common/lib/libc/string/bcopy.c    Mon Apr 14 18:18:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcopy.c,v 1.9 2009/03/18 12:25:06 tsutsui Exp $        */
+/*     $NetBSD: bcopy.c,v 1.10 2014/04/14 18:18:58 joerg Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)bcopy.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: bcopy.c,v 1.9 2009/03/18 12:25:06 tsutsui Exp $");
+__RCSID("$NetBSD: bcopy.c,v 1.10 2014/04/14 18:18:58 joerg Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -89,8 +89,7 @@
        unsigned long u;
 
 #if !defined(_KERNEL)
-       _DIAGASSERT(dst0 != 0);
-       _DIAGASSERT(src0 != 0);
+       _DIAGASSERT((dst0 && src0) || length == 0);
 #endif
 
        if (length == 0 || dst == src)          /* nothing to do */



Home | Main Index | Thread Index | Old Index