diff options
author | Robert Mustacchi <rm@fingolfin.org> | 2020-11-24 07:38:12 -0800 |
---|---|---|
committer | Robert Mustacchi <rm@fingolfin.org> | 2020-12-02 08:08:39 -0800 |
commit | 2e8cdddb340293882c888e83152059f02ec5d59b (patch) | |
tree | d9e4150bc38f1b373f3fa8ad5d00c9e518dc1d57 | |
parent | 7b4214534ccdf6f8aa6e566d7501aab328c72e84 (diff) | |
download | illumos-joyent-2e8cdddb340293882c888e83152059f02ec5d59b.tar.gz |
13333 spellcheck1 doesn't zero table memory
Reviewed by: Andy Fiddaman <andy@omnios.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r-- | usr/src/cmd/spell/Makefile | 18 | ||||
-rw-r--r-- | usr/src/cmd/spell/spellin.c | 10 |
2 files changed, 13 insertions, 15 deletions
diff --git a/usr/src/cmd/spell/Makefile b/usr/src/cmd/spell/Makefile index 0aab579243..e0af91a7f0 100644 --- a/usr/src/cmd/spell/Makefile +++ b/usr/src/cmd/spell/Makefile @@ -113,19 +113,19 @@ htemp1: list local extra hashmk1 $(RM) $@; cat list local extra | $(_SH_) ./hashmk1 > $@ hlista: american $(HASHPROG) htemp1 - $(RM) htemp2; ./hashmk1 <american |sort -u - htemp1 >htemp2 - $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@ - $(RM) htemp2 + $(RM) htemp2a; ./hashmk1 <american |sort -u - htemp1 >htemp2a + $(RM) $@; ./spellin1 `wc htemp2a|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2a >$@ + $(RM) htemp2a hlistb: british $(HASHPROG) htemp1 - $(RM) htemp2; ./hashmk1 <british |sort -u - htemp1 >htemp2 - $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@ - $(RM) htemp2 + $(RM) htemp2b; ./hashmk1 <british |sort -u - htemp1 >htemp2b + $(RM) $@; ./spellin1 `wc htemp2b|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2b >$@ + $(RM) htemp2b hstop: stop $(HASHPROG) - $(RM) htemp2; ./hashmk1 <stop | sort -u >htemp2 - $(RM) $@; ./spellin1 `wc htemp2|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2 >$@ - $(RM) htemp2 + $(RM) htemp2s; ./hashmk1 <stop | sort -u >htemp2s + $(RM) $@; ./spellin1 `wc htemp2s|sed -n 's/\([^ ]\) .*/\1/p'`<htemp2s >$@ + $(RM) htemp2s install: all $(ROOTDIRS) $(ROOTBINF) $(ROOTSPELLF) $(ROOTVARADMF) diff --git a/usr/src/cmd/spell/spellin.c b/usr/src/cmd/spell/spellin.c index cfc253702b..afbdc6b0e4 100644 --- a/usr/src/cmd/spell/spellin.c +++ b/usr/src/cmd/spell/spellin.c @@ -25,11 +25,9 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <unistd.h> #include <stdlib.h> #include <stdio.h> @@ -97,7 +95,7 @@ main(int argc, char **argv) (void) fprintf(stderr, gettext("%s: arg count\n"), argv[0]); exit(1); } - table = (unsigned *)malloc(ND * sizeof (*table)); + table = (unsigned *)calloc(ND, sizeof (*table)); if (table == 0) { (void) fprintf(stderr, gettext("%s: no space for table\n"), argv[0]); @@ -129,8 +127,8 @@ main(int argc, char **argv) break; } if (i > B) { - if (!(append((unsigned)(w1>>(long) (i-B)), B) && - append((unsigned)(w1<<(long) (B+B-i)), + if (!(append((unsigned)(w1>>(long)(i-B)), B) && + append((unsigned)(w1<<(long)(B+B-i)), i-B))) ignore++; } else |