]> git.saurik.com Git - apple/libc.git/blob - locale/FreeBSD/euc.c.patch
9d60826b15e217e63dc5bc69df5e5edc92dbb38f
[apple/libc.git] / locale / FreeBSD / euc.c.patch
1 --- euc.c.orig Tue May 20 15:21:44 2003
2 +++ euc.c Wed Jun 18 12:01:30 2003
3 @@ -48,6 +48,7 @@
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 +#include <ctype.h>
8
9 rune_t _EUC_sgetrune(const char *, size_t, char const **);
10 int _EUC_sputrune(rune_t, char *, size_t, char **);
11 @@ -135,11 +136,10 @@
12 rune_t rune = 0;
13 int len, set;
14
15 - if (n < 1 || (len = CEI->count[set = _euc_set(*string)]) > n) {
16 - if (result)
17 - *result = string;
18 + if (result)
19 + *result = string;
20 + if (n < 1 || (len = CEI->count[set = _euc_set(*string)]) > n)
21 return (_INVALID_RUNE);
22 - }
23 switch (set) {
24 case 3:
25 case 2:
26 @@ -151,6 +151,11 @@
27 while (len-- > 0)
28 rune = (rune << 8) | ((u_int)(*string++) & 0xff);
29 break;
30 + }
31 + if (!isrune(rune)) {
32 + if (result)
33 + (*result)++;
34 + return (_INVALID_RUNE);
35 }
36 if (result)
37 *result = string;