]> git.pld-linux.org Git - packages/aspell.git/blame - aspell-buffer-fix.patch
- security patch obtained from:
[packages/aspell.git] / aspell-buffer-fix.patch
CommitLineData
fda96dde 1diff -urN aspell-0.50.5/prog/compress.c aspell-0.50.5.new/prog/compress.c
2--- aspell-0.50.5/prog/compress.c 2002-08-31 11:51:11.000000000 -0700
3+++ aspell-0.50.5.new/prog/compress.c 2004-06-16 10:14:42.000000000 -0700
4@@ -28,6 +28,11 @@
5
6 #endif
7
8+#define WORD_BUFF_SIZE 256
9+
10+int count = 0;
11+
12+
13 void usage ()
14 {
15 fputs("Compresses or uncompresses sorted word lists.\n" , stderr);
16@@ -45,8 +50,9 @@
17 if (c == EOF) return 0;
18 do {
19 *w++ = (char)(c);
20- } while (c = getc(in), c != EOF && c > 32);
21+ } while (c = getc(in), c != EOF && c > 32 && count < (WORD_BUFF_SIZE - 1));
22 *w = '\0';
23+ count++;
24 ungetc(c, in);
25 if (c == EOF) return 0;
26 else return 1;
27@@ -61,14 +67,15 @@
28
29 } else if (argv[1][0] == 'c') {
30
31- char s1[256];
32- char s2[256];
33+ char s1[WORD_BUFF_SIZE];
34+ char s2[WORD_BUFF_SIZE];
35 char * prev = s2;
36 char * cur = s1;
37 *prev = '\0';
38
39 SETBIN (stdout);
40
41+ while (count < WORD_BUFF_SIZE) {
42 while (get_word(stdin, cur)) {
43 int i = 0;
44 /* get the length of the prefix */
45@@ -85,11 +92,12 @@
46 prev = s2; cur = s1;
47 }
48 }
49+ }
50 return 0;
51
52 } else if (argv[1][0] == 'd') {
53
54- char cur[256];
55+ char cur[WORD_BUFF_SIZE];
56 int i;
57 int c;
58
59@@ -100,8 +108,11 @@
60 if (i == 0)
61 i = getc(stdin);
62 --i;
63- while ((c = getc(stdin)) > 32)
64+ while ((c = getc(stdin)) > 32 && i < (WORD_BUFF_SIZE -1)) {
65 cur[i++] = (char)c;
66+ count++;
67+ }
68+
69 cur[i] = '\0';
70 fputs(cur, stdout);
71 putc('\n', stdout);
This page took 0.088906 seconds and 4 git commands to generate.