~ubuntu-branches/ubuntu/gutsy/vnc4/gutsy

« back to all changes in this revision

Viewing changes to unix/xc/lib/X11/lcUniConv/iso8859_6.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2006-05-15 20:35:17 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515203517-l4lre1ku942mn26k
Tags: 4.1.1+X4.3.0-10
* Correction of critical security issue. Thanks to Martin Kogler
  <e9925248@student.tuwien.ac.at> that informed me about the issue,
  and provided the patch.
  This flaw was originally found by Steve Wiseman of intelliadmin.com.
* Applied patch from Javier Kohen <jkohen@users.sourceforge.net> that
  inform the user that only 8 first characters of the password will
  actually be used when typing more than 8 characters, closes:
  #355619.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XFree86: xc/lib/X11/lcUniConv/iso8859_6.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
 
2
 
 
3
/*
 
4
 * ISO-8859-6
 
5
 */
 
6
 
 
7
static const unsigned short iso8859_6_2uni[96] = {
 
8
  /* 0xa0 */
 
9
  0x00a0, 0xfffd, 0xfffd, 0xfffd, 0x00a4, 0xfffd, 0xfffd, 0xfffd,
 
10
  0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x060c, 0x00ad, 0xfffd, 0xfffd,
 
11
  /* 0xb0 */
 
12
  0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
 
13
  0xfffd, 0xfffd, 0xfffd, 0x061b, 0xfffd, 0xfffd, 0xfffd, 0x061f,
 
14
  /* 0xc0 */
 
15
  0xfffd, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
 
16
  0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f,
 
17
  /* 0xd0 */
 
18
  0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
 
19
  0x0638, 0x0639, 0x063a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
 
20
  /* 0xe0 */
 
21
  0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
 
22
  0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f,
 
23
  /* 0xf0 */
 
24
  0x0650, 0x0651, 0x0652, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
 
25
  0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd,
 
26
};
 
27
 
 
28
static int
 
29
iso8859_6_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
 
30
{
 
31
  unsigned char c = *s;
 
32
  if (c < 0xa0) {
 
33
    *pwc = (ucs4_t) c;
 
34
    return 1;
 
35
  }
 
36
  else {
 
37
    unsigned short wc = iso8859_6_2uni[c-0xa0];
 
38
    if (wc != 0xfffd) {
 
39
      *pwc = (ucs4_t) wc;
 
40
      return 1;
 
41
    }
 
42
  }
 
43
  return RET_ILSEQ;
 
44
}
 
45
 
 
46
static const unsigned char iso8859_6_page00[16] = {
 
47
  0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
 
48
  0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
 
49
};
 
50
static const unsigned char iso8859_6_page06[80] = {
 
51
  0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
 
52
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
 
53
  0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */
 
54
  0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */
 
55
  0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */
 
56
  0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */
 
57
  0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
 
58
  0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */
 
59
  0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */
 
60
  0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
 
61
};
 
62
 
 
63
static int
 
64
iso8859_6_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
 
65
{
 
66
  unsigned char c = 0;
 
67
  if (wc < 0x00a0) {
 
68
    *r = wc;
 
69
    return 1;
 
70
  }
 
71
  else if (wc >= 0x00a0 && wc < 0x00b0)
 
72
    c = iso8859_6_page00[wc-0x00a0];
 
73
  else if (wc >= 0x0608 && wc < 0x0658)
 
74
    c = iso8859_6_page06[wc-0x0608];
 
75
  if (c != 0) {
 
76
    *r = c;
 
77
    return 1;
 
78
  }
 
79
  return RET_ILSEQ;
 
80
}