Module Name: src Committed By: simonb Date: Sat Apr 17 06:02:35 UTC 2021
Modified Files: src/common/lib/libc/string: memset2.c Log Message: Cast the fill value to unsigned char so that the "fill" value used for full-word fills isn't garbage. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/string/memset2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/string/memset2.c diff -u src/common/lib/libc/string/memset2.c:1.6 src/common/lib/libc/string/memset2.c:1.7 --- src/common/lib/libc/string/memset2.c:1.6 Sat Apr 17 05:57:11 2021 +++ src/common/lib/libc/string/memset2.c Sat Apr 17 06:02:35 2021 @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: memset2.c,v 1.6 2021/04/17 05:57:11 simonb Exp $"); +__RCSID("$NetBSD: memset2.c,v 1.7 2021/04/17 06:02:35 simonb Exp $"); #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -97,7 +97,7 @@ memset(void *addr, int c, size_t len) * The conditional at the end prevents GCC from complaing about * shift count >= width of type */ - fill = c; + fill = (unsigned char)c; fill |= fill << 8; fill |= fill << 16; fill |= fill << (sizeof(c) < sizeof(fill) ? 32 : 0);