Mercurial > illumos > git > illumos-gate
changeset 20177:4c8d447baf62
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>
author | Robert Mustacchi <rm@fingolfin.org> |
---|---|
date | Tue, 24 Nov 2020 07:38:12 -0800 |
parents | fccaa6b5aff6 |
children | dc366f3ed5bf |
files | usr/src/cmd/spell/Makefile usr/src/cmd/spell/spellin.c |
diffstat | 2 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/spell/Makefile Mon Nov 23 14:09:18 2020 -0800 +++ b/usr/src/cmd/spell/Makefile Tue Nov 24 07:38:12 2020 -0800 @@ -113,19 +113,19 @@ $(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)
--- a/usr/src/cmd/spell/spellin.c Mon Nov 23 14:09:18 2020 -0800 +++ b/usr/src/cmd/spell/spellin.c Tue Nov 24 07:38:12 2020 -0800 @@ -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 @@ (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 @@ 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