summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-10-16 11:37:38 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-10-16 11:37:38 +0000
commit9acd2d9b3ce1cc08aa98adc434b11d8ef5b8b6f0 (patch)
tree26381dc2c8f2afcccd8979d711a33ab0f820c273 /lib/libc
parent4bcea0f89cfe0aebea13add97b1b998bcafc8c39 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/none.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c
index f062f90ac10e..1b1dc704d706 100644
--- a/lib/libc/locale/none.c
+++ b/lib/libc/locale/none.c
@@ -40,6 +40,7 @@ static char sccsid[] = "@(#)none.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <rune.h>
@@ -82,8 +83,14 @@ _none_sputrune(c, string, n, result)
size_t n;
{
if (n >= 1) {
- if (string)
+ if (string) {
+ if (c < 0 || c > UCHAR_MAX) {
+ if (result)
+ *result = NULL;
+ return (0);
+ }
*string = c;
+ }
if (result)
*result = string + 1;
} else if (result)