1 Author: Anton Gladky <gladk@debian.org>
2 LastChanged: Tue, 26 Feb 2013 20:40:25 +0100
3 BugDebian: http://bugs.debian.org/700914
4 Description: This patch was created by oCert according to
5 http://www.ocert.org/advisories/ocert-2008-014.html
6 and can be downloaded from
7 http://www.ocert.org/analysis/2008-014/wordnet.patch
8 Unfortunately the original patch had a problem which
9 caused 'wordnet test -synsn' to fail. The critical
10 part of the patch was removed from the whole patch
11 set and is moved to 51_overflows_memcpy.patch which
12 uses memcpy instead of the formerly used strcpy.
16 @@ -28,7 +28,7 @@ char *read_index(long offset, FILE *fp)
23 fseek( fp, offset, SEEK_SET );
24 fgets(linep, LINE_LEN, fp);
25 @@ -58,6 +58,8 @@ char *bin_search(char *searchkey, FILE *
26 last_bin_search_offset = ftell( fp );
27 fgets(linep, LINE_LEN, fp);
28 length = (int)(strchr(linep, ' ') - linep);
29 + if (length > (sizeof(key) - 1))
31 strncpy(key, linep, length);
33 if(strcmp(key, searchkey) < 0) {
34 @@ -110,6 +112,8 @@ static int bin_search_key(char *searchke
36 if (getc(fp) == EOF) { /* only 1 line in file */
37 length = (int)(strchr(linep, ' ') - linep);
38 + if (length > (sizeof(key) - 1))
40 strncpy(key, linep, length);
42 if(strcmp(key, searchkey) > 0) {
43 @@ -132,6 +136,8 @@ static int bin_search_key(char *searchke
44 if (fgets(linep, LINE_LEN, fp) != NULL) {
45 offset2 = ftell(fp); /* offset at start of next line */
46 length = (int)(strchr(linep, ' ') - linep);
47 + if (length > (sizeof(key) - 1))
49 strncpy(key, linep, length);
51 if(strcmp(key, searchkey) < 0) { /* further in file */
54 @@ -51,21 +51,21 @@ static struct {
57 } prepositions[NUMPREPS] = {
90 static FILE *exc_fps[NUMPARTS + 1];
91 @@ -144,18 +144,19 @@ static int do_init(void)
93 sprintf(searchdir, DEFAULTPATH);
95 - if ((env = getenv("WNSEARCHDIR")) != NULL)
96 - strcpy(searchdir, env);
97 - else if ((env = getenv("WNHOME")) != NULL)
98 - sprintf(searchdir, "%s%s", env, DICTDIR);
100 + if ((env = getenv("WNSEARCHDIR")) != NULL) {
101 + snprintf(searchdir, sizeof(searchdir), "%s", env);
102 + } else if ((env = getenv("WNHOME")) != NULL) {
103 + snprintf(searchdir, sizeof(searchdir), "%s%s", env, DICTDIR);
105 strcpy(searchdir, DEFAULTPATH);
109 for (i = 1; i <= NUMPARTS; i++) {
110 - sprintf(fname, EXCFILE, searchdir, partnames[i]);
111 + snprintf(fname, sizeof(fname), EXCFILE, searchdir, partnames[i]);
112 if ((exc_fps[i] = fopen(fname, "r")) == NULL) {
114 + snprintf(msgbuf, sizeof(msgbuf),
115 "WordNet library error: Can't open exception file(%s)\n\n",
117 display_message(msgbuf);
118 @@ -178,13 +179,16 @@ char *morphstr(char *origstr, int pos)
120 char *end_idx1, *end_idx2;
124 if (pos == SATELLITE)
127 /* First time through for this string */
129 if (origstr != NULL) {
130 + if (strlen(origstr) > WORDBUF - 1)
133 /* Assume string hasn't had spaces substitued with '_' */
134 strtolower(strsubst(strcpy(str, origstr), ' ', '_'));
136 @@ -232,7 +236,7 @@ char *morphstr(char *origstr, int pos)
137 if (end_idx < 0) return(NULL); /* shouldn't do this */
138 strncpy(word, str + st_idx, end_idx - st_idx);
139 word[end_idx - st_idx] = '\0';
140 - if(tmp = morphword(word, pos))
141 + if ((tmp = morphword(word, pos)) != NULL)
142 strcat(searchstr,tmp);
144 strcat(searchstr,word);
145 @@ -240,7 +244,7 @@ char *morphstr(char *origstr, int pos)
146 st_idx = end_idx + 1;
149 - if(tmp = morphword(strcpy(word, str + st_idx), pos))
150 + if ((tmp = morphword(strcpy(word, str + st_idx), pos)) != NULL)
151 strcat(searchstr,tmp);
153 strcat(searchstr,word);
154 @@ -270,16 +274,15 @@ char *morphword(char *word, int pos)
158 - static char retval[WORDBUF];
159 - char *tmp, tmpbuf[WORDBUF], *end;
161 - sprintf(retval,"");
162 - sprintf(tmpbuf, "");
165 + static char retval[WORDBUF] = "";
166 + char *tmp, tmpbuf[WORDBUF] = "", *end = "";
171 + if (strlen(word) > WORDBUF - 1)
174 /* first look for word on exception list */
176 if((tmp = exc_lookup(word, pos)) != NULL)
177 @@ -335,7 +338,10 @@ static char *wordbase(char *word, int en
180 static char copy[WORDBUF];
183 + if (strlen(word) > WORDBUF - 1)
187 if(strend(copy,sufx[ender])) {
188 pt1=strchr(copy,'\0');
189 @@ -368,13 +374,14 @@ static char *exc_lookup(char *word, int
191 static char line[WORDBUF], *beglp, *endlp;
195 if (exc_fps[pos] == NULL)
198 /* first time through load line from exception file */
200 + if (strlen(word) > WORDBUF - 1)
202 if ((excline = bin_search(word, exc_fps[pos])) != NULL) {
203 strcpy(line, excline);
204 endlp = strchr(line,' ');
205 @@ -403,6 +410,9 @@ static char *morphprep(char *s)
206 char word[WORDBUF], end[WORDBUF];
207 static char retval[WORDBUF];
209 + if (strlen(s) > WORDBUF - 1)
212 /* Assume that the verb is the first word in the phrase. Strip it
213 off, check for validity, then try various morphs with the
214 rest of the phrase tacked on, trying to find a match. */
215 @@ -410,7 +420,7 @@ static char *morphprep(char *s)
216 rest = strchr(s, '_');
217 last = strrchr(s, '_');
218 if (rest != last) { /* more than 2 words */
219 - if (lastwd = morphword(last + 1, NOUN)) {
220 + if ((lastwd = morphword(last + 1, NOUN)) != NULL) {
221 strncpy(end, rest, last - rest + 1);
222 end[last-rest+1] = '\0';
234 @@ -119,33 +120,22 @@ IndexPtr parse_index(long offset, int db
236 line = read_index( offset, indexfps[dbase] );
238 - idx = (IndexPtr)malloc(sizeof(Index));
239 + idx = (IndexPtr)calloc(1, sizeof(Index));
242 /* set offset of entry in index file */
243 idx->idxoffset = offset;
248 - idx->tagged_cnt = 0;
255 ptrtok=strtok(line," \n");
257 - idx->wd = malloc(strlen(ptrtok) + 1);
258 + idx->wd = strdup(ptrtok);
260 - strcpy(idx->wd, ptrtok);
262 /* get the part of speech */
263 ptrtok=strtok(NULL," \n");
264 - idx->pos = malloc(strlen(ptrtok) + 1);
265 + idx->pos = strdup(ptrtok);
267 - strcpy(idx->pos, ptrtok);
269 /* get the collins count */
270 ptrtok=strtok(NULL," \n");
271 @@ -154,7 +144,12 @@ IndexPtr parse_index(long offset, int db
272 /* get the number of pointers types */
273 ptrtok=strtok(NULL," \n");
274 idx->ptruse_cnt = atoi(ptrtok);
277 + if (idx->ptruse_cnt < 0 || (unsigned int)idx->ptruse_cnt > UINT_MAX/sizeof(int)) {
282 if (idx->ptruse_cnt) {
283 idx->ptruse = (int *) malloc(idx->ptruse_cnt * (sizeof(int)));
285 @@ -173,9 +168,14 @@ IndexPtr parse_index(long offset, int db
286 /* get the number of senses that are tagged */
287 ptrtok=strtok(NULL," \n");
288 idx->tagged_cnt = atoi(ptrtok);
291 + if (idx->off_cnt < 0 || (unsigned long)idx->off_cnt > ULONG_MAX/sizeof(long)) {
296 /* make space for the offsets */
297 - idx->offset = (long *) malloc(idx->off_cnt * (sizeof(long)));
298 + idx->offset = (unsigned long *) malloc(idx->off_cnt * sizeof(long));
301 /* get the offsets */
302 @@ -197,15 +197,21 @@ IndexPtr getindex(char *searchstr, int d
303 char strings[MAX_FORMS][WORDBUF]; /* vector of search strings */
304 static IndexPtr offsets[MAX_FORMS];
308 /* This works like strrok(): if passed with a non-null string,
309 prepare vector of search strings and offsets. If string
310 is null, look at current list of offsets and return next
311 one, or NULL if no more alternatives for this word. */
313 if (searchstr != NULL) {
314 + /* Bail out if the input is too long for us to handle */
315 + if (strlen(searchstr) > (WORDBUF - 1)) {
316 + strcpy(msgbuf, "WordNet library error: search term is too long\n");
317 + display_message(msgbuf);
323 strtolower(searchstr);
324 for (i = 0; i < MAX_FORMS; i++) {
325 strcpy(strings[i], searchstr);
326 @@ -229,11 +235,11 @@ IndexPtr getindex(char *searchstr, int d
327 /* Get offset of first entry. Then eliminate duplicates
328 and get offsets of unique strings. */
330 - if (strings[0][0] != NULL)
331 + if (strings[0] != NULL)
332 offsets[0] = index_lookup(strings[0], dbase);
334 for (i = 1; i < MAX_FORMS; i++)
335 - if ((strings[i][0]) != NULL && (strcmp(strings[0], strings[i])))
336 + if (strings[i] != NULL && (strcmp(strings[0], strings[i])))
337 offsets[i] = index_lookup(strings[i], dbase);
340 @@ -272,7 +278,7 @@ SynsetPtr read_synset(int dbase, long bo
341 SynsetPtr parse_synset(FILE *fp, int dbase, char *word)
343 static char line[LINEBUF];
344 - char tbuf[SMLINEBUF];
345 + char tbuf[SMLINEBUF] = "";
349 @@ -286,33 +292,11 @@ SynsetPtr parse_synset(FILE *fp, int dba
350 if ((tmpptr = fgets(line, LINEBUF, fp)) == NULL)
353 - synptr = (SynsetPtr)malloc(sizeof(Synset));
354 + synptr = (SynsetPtr)calloc(1, sizeof(Synset));
357 - synptr->hereiam = 0;
359 synptr->sstype = DONT_KNOW;
361 - synptr->pos = '\0';
362 - synptr->wcount = 0;
363 - synptr->words = '\0';
364 - synptr->whichword = 0;
365 - synptr->ptrcount = 0;
366 - synptr->ptrtyp = '\0';
367 - synptr->ptroff = '\0';
368 - synptr->ppos = '\0';
369 - synptr->pto = '\0';
370 - synptr->pfrm = '\0';
371 - synptr->fcount = 0;
372 - synptr->frmid = '\0';
373 - synptr->frmto = '\0';
374 - synptr->defn = '\0';
376 - synptr->nextss = NULL;
377 - synptr->nextform = NULL;
378 synptr->searchtype = -1;
379 - synptr->ptrlist = NULL;
380 - synptr->headword = NULL;
381 - synptr->headsense = 0;
385 @@ -322,7 +306,7 @@ SynsetPtr parse_synset(FILE *fp, int dba
387 /* sanity check - make sure starting file offset matches first field */
388 if (synptr->hereiam != loc) {
389 - sprintf(msgbuf, "WordNet library error: no synset at location %d\n",
390 + sprintf(msgbuf, "WordNet library error: no synset at location %ld\n",
392 display_message(msgbuf);
394 @@ -335,16 +319,20 @@ SynsetPtr parse_synset(FILE *fp, int dba
397 ptrtok = strtok(NULL, " \n");
398 - synptr->pos = malloc(strlen(ptrtok) + 1);
399 + synptr->pos = strdup(ptrtok);
401 - strcpy(synptr->pos, ptrtok);
402 if (getsstype(synptr->pos) == SATELLITE)
403 synptr->sstype = INDIRECT_ANT;
405 /* looking at numwords */
406 ptrtok = strtok(NULL, " \n");
407 synptr->wcount = strtol(ptrtok, NULL, 16);
410 + if (synptr->wcount < 0 || (unsigned int)synptr->wcount > UINT_MAX/sizeof(char *)) {
415 synptr->words = (char **)malloc(synptr->wcount * sizeof(char *));
416 assert(synptr->words);
417 synptr->wnsns = (int *)malloc(synptr->wcount * sizeof(int));
418 @@ -354,9 +342,8 @@ SynsetPtr parse_synset(FILE *fp, int dba
420 for (i = 0; i < synptr->wcount; i++) {
421 ptrtok = strtok(NULL, " \n");
422 - synptr->words[i] = malloc(strlen(ptrtok) + 1);
423 + synptr->words[i] = strdup(ptrtok);
424 assert(synptr->words[i]);
425 - strcpy(synptr->words[i], ptrtok);
427 /* is this the word we're looking for? */
429 @@ -371,6 +358,12 @@ SynsetPtr parse_synset(FILE *fp, int dba
430 ptrtok = strtok(NULL," \n");
431 synptr->ptrcount = atoi(ptrtok);
433 + /* Should we check for long here as well? */
434 + if (synptr->ptrcount < 0 || (unsigned int)synptr->ptrcount > UINT_MAX/sizeof(int)) {
439 if (synptr->ptrcount) {
441 /* alloc storage for the pointers */
442 @@ -455,21 +448,23 @@ SynsetPtr parse_synset(FILE *fp, int dba
443 ptrtok = strtok(NULL," \n");
445 ptrtok = strtok(NULL," \n");
447 while (ptrtok != NULL) {
448 + if (strlen(ptrtok) + strlen(tbuf) + 1 + 1 > sizeof(tbuf)) {
453 ptrtok = strtok(NULL, " \n");
457 - assert((1 + strlen(tbuf)) < sizeof(tbuf));
458 - synptr->defn = malloc(strlen(tbuf) + 4);
459 + synptr->defn = malloc(strlen(tbuf) + 3);
460 assert(synptr->defn);
461 sprintf(synptr->defn,"(%s)",tbuf);
464 if (keyindexfp) { /* we have unique keys */
465 - sprintf(tmpbuf, "%c:%8.8d", partchars[dbase], synptr->hereiam);
466 + sprintf(tmpbuf, "%c:%8.8ld", partchars[dbase], synptr->hereiam);
467 synptr->key = GetKeyForOffset(tmpbuf);
470 @@ -635,7 +630,7 @@ static void traceptrs(SynsetPtr synptr,
472 if ((ptrtyp == PERTPTR || ptrtyp == PPLPTR) &&
473 synptr->pto[i] != 0) {
474 - sprintf(tbuf, " (Sense %d)\n",
475 + snprintf(tbuf, sizeof(tbuf), " (Sense %d)\n",
476 cursyn->wnsns[synptr->pto[i] - 1]);
477 printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i],
478 SKIP_ANTS, PRINT_MARKER);
479 @@ -656,7 +651,7 @@ static void traceptrs(SynsetPtr synptr,
480 traceptrs(cursyn, HYPERPTR, getpos(cursyn->pos), 0);
482 } else if (ptrtyp == ANTPTR && dbase != ADJ && synptr->pto[i] != 0) {
483 - sprintf(tbuf, " (Sense %d)\n",
484 + snprintf(tbuf, sizeof(tbuf), " (Sense %d)\n",
485 cursyn->wnsns[synptr->pto[i] - 1]);
486 printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i],
487 SKIP_ANTS, PRINT_MARKER);
488 @@ -817,7 +812,7 @@ static void tracenomins(SynsetPtr synptr
490 cursyn = read_synset(synptr->ppos[i], synptr->ptroff[i], "");
492 - sprintf(tbuf, "#%d\n",
493 + snprintf(tbuf, sizeof(tbuf), "#%d\n",
494 cursyn->wnsns[synptr->pto[i] - 1]);
495 printsynset(prefix, cursyn, tbuf, DEFOFF, synptr->pto[i],
496 SKIP_ANTS, SKIP_MARKER);
497 @@ -989,12 +984,12 @@ void getexample(char *offset, char *wd)
500 if (vsentfilefp != NULL) {
501 - if (line = bin_search(offset, vsentfilefp)) {
502 + if ((line = bin_search(offset, vsentfilefp)) != NULL) {
506 printbuffer(" EX: ");
507 - sprintf(sentbuf, line, wd);
508 + snprintf(sentbuf, sizeof(sentbuf), line, wd);
509 printbuffer(sentbuf);
512 @@ -1011,7 +1006,7 @@ int findexample(SynsetPtr synptr)
513 if (vidxfilefp != NULL) {
514 wdnum = synptr->whichword - 1;
516 - sprintf(tbuf,"%s%%%-1.1d:%-2.2d:%-2.2d::",
517 + snprintf(tbuf, sizeof(tbuf), "%s%%%-1.1d:%-2.2d:%-2.2d::",
518 synptr->words[wdnum],
521 @@ -1124,7 +1119,7 @@ static void freq_word(IndexPtr index)
522 if (cnt >= 17 && cnt <= 32) familiar = 6;
523 if (cnt > 32 ) familiar = 7;
526 + snprintf(tmpbuf, sizeof(tmpbuf),
527 "\n%s used as %s is %s (polysemy count = %d)\n",
528 index->wd, a_an[getpos(index->pos)], freqcats[familiar], cnt);
530 @@ -1147,6 +1142,9 @@ void wngrep (char *word_passed, int pos)
534 + if (strlen(word_passed) + 1 > sizeof(word))
537 strcpy (word, word_passed);
538 ToLowerCase(word); /* map to lower case for index file search */
539 strsubst (word, ' ', '_'); /* replace spaces with underscores */
540 @@ -1169,7 +1167,7 @@ void wngrep (char *word_passed, int pos)
541 ((line[loc + wordlen] == '-') || (line[loc + wordlen] == '_')))
543 strsubst (line, '_', ' ');
544 - sprintf (tmpbuf, "%s\n", line);
545 + snprintf (tmpbuf, sizeof(tmpbuf), "%s\n", line);
546 printbuffer (tmpbuf);
549 @@ -1683,9 +1681,8 @@ SynsetPtr traceptrs_ds(SynsetPtr synptr,
550 cursyn = read_synset(synptr->ppos[i],
553 - synptr->headword = malloc(strlen(cursyn->words[0]) + 1);
554 + synptr->headword = strdup(cursyn->words[0]);
555 assert(synptr->headword);
556 - strcpy(synptr->headword, cursyn->words[0]);
557 synptr->headsense = cursyn->lexid[0];
560 @@ -2013,7 +2010,7 @@ static int getsearchsense(SynsetPtr synp
561 strsubst(strcpy(wdbuf, synptr->words[whichword - 1]), ' ', '_');
564 - if (idx = index_lookup(wdbuf, getpos(synptr->pos))) {
565 + if ((idx = index_lookup(wdbuf, getpos(synptr->pos))) != NULL) {
566 for (i = 0; i < idx->off_cnt; i++)
567 if (idx->offset[i] == synptr->hereiam) {
569 @@ -2037,7 +2034,7 @@ static void printsynset(char *head, Syns
572 if (offsetflag) /* print synset offset */
573 - sprintf(tbuf + strlen(tbuf),"{%8.8d} ", synptr->hereiam);
574 + sprintf(tbuf + strlen(tbuf),"{%8.8ld} ", synptr->hereiam);
575 if (fileinfoflag) { /* print lexicographer file information */
576 sprintf(tbuf + strlen(tbuf), "<%s> ", lexfiles[synptr->fnum]);
577 prlexid = 1; /* print lexicographer id after word */
578 @@ -2072,7 +2069,7 @@ static void printantsynset(SynsetPtr syn
582 - sprintf(tbuf,"{%8.8d} ", synptr->hereiam);
583 + sprintf(tbuf,"{%8.8ld} ", synptr->hereiam);
585 sprintf(tbuf + strlen(tbuf),"<%s> ", lexfiles[synptr->fnum]);
589 @@ -48,7 +48,7 @@ int wninit(void)
593 - if (env = getenv("WNDBVERSION")) {
594 + if ((env = getenv("WNDBVERSION")) != NULL) {
595 wnrelease = strdup(env); /* set release */
598 @@ -70,7 +70,7 @@ int re_wninit(void)
602 - if (env = getenv("WNDBVERSION")) {
603 + if ((env = getenv("WNDBVERSION")) != NULL) {
604 wnrelease = strdup(env); /* set release */
607 @@ -149,25 +149,25 @@ static int do_init(void)
608 sprintf(searchdir, DEFAULTPATH);
610 if ((env = getenv("WNSEARCHDIR")) != NULL)
611 - strcpy(searchdir, env);
612 + snprintf(searchdir, sizeof(searchdir), "%s", env);
613 else if ((env = getenv("WNHOME")) != NULL)
614 - sprintf(searchdir, "%s%s", env, DICTDIR);
615 + snprintf(searchdir, sizeof(searchdir), "%s%s", env, DICTDIR);
617 strcpy(searchdir, DEFAULTPATH);
620 for (i = 1; i < NUMPARTS + 1; i++) {
621 - sprintf(tmpbuf, DATAFILE, searchdir, partnames[i]);
622 + snprintf(tmpbuf, sizeof(tmpbuf), DATAFILE, searchdir, partnames[i]);
623 if((datafps[i] = fopen(tmpbuf, "r")) == NULL) {
625 + snprintf(msgbuf, sizeof(msgbuf),
626 "WordNet library error: Can't open datafile(%s)\n",
628 display_message(msgbuf);
631 - sprintf(tmpbuf, INDEXFILE, searchdir, partnames[i]);
632 + snprintf(tmpbuf, sizeof(tmpbuf), INDEXFILE, searchdir, partnames[i]);
633 if((indexfps[i] = fopen(tmpbuf, "r")) == NULL) {
635 + snprintf(msgbuf, sizeof(msgbuf),
636 "WordNet library error: Can't open indexfile(%s)\n",
638 display_message(msgbuf);
639 @@ -178,35 +178,35 @@ static int do_init(void)
640 /* This file isn't used by the library and doesn't have to
641 be present. No error is reported if the open fails. */
643 - sprintf(tmpbuf, SENSEIDXFILE, searchdir);
644 + snprintf(tmpbuf, sizeof(tmpbuf), SENSEIDXFILE, searchdir);
645 sensefp = fopen(tmpbuf, "r");
647 /* If this file isn't present, the runtime code will skip printint out
648 the number of times each sense was tagged. */
650 - sprintf(tmpbuf, CNTLISTFILE, searchdir);
651 + snprintf(tmpbuf, sizeof(tmpbuf), CNTLISTFILE, searchdir);
652 cntlistfp = fopen(tmpbuf, "r");
654 /* This file doesn't have to be present. No error is reported if the
657 - sprintf(tmpbuf, KEYIDXFILE, searchdir);
658 + snprintf(tmpbuf, sizeof(tmpbuf), KEYIDXFILE, searchdir);
659 keyindexfp = fopen(tmpbuf, "r");
661 - sprintf(tmpbuf, REVKEYIDXFILE, searchdir);
662 + snprintf(tmpbuf, sizeof(tmpbuf), REVKEYIDXFILE, searchdir);
663 revkeyindexfp = fopen(tmpbuf, "r");
665 - sprintf(tmpbuf, VRBSENTFILE, searchdir);
666 + snprintf(tmpbuf, sizeof(tmpbuf), VRBSENTFILE, searchdir);
667 if ((vsentfilefp = fopen(tmpbuf, "r")) == NULL) {
669 + snprintf(msgbuf, sizeof(msgbuf),
670 "WordNet library warning: Can't open verb example sentence file(%s)\n",
672 display_message(msgbuf);
675 - sprintf(tmpbuf, VRBIDXFILE, searchdir);
676 + snprintf(tmpbuf, sizeof(tmpbuf), VRBIDXFILE, searchdir);
677 if ((vidxfilefp = fopen(tmpbuf, "r")) == NULL) {
679 + snprintf(msgbuf, sizeof(msgbuf),
680 "WordNet library warning: Can't open verb example sentence index file(%s)\n",
682 display_message(msgbuf);
685 @@ -131,7 +131,7 @@ static void printusage(), printlicense()
686 printsearches(char *, int, unsigned long);
687 static int error_message(char *);
689 -main(int argc,char *argv[])
690 +int main(int argc,char *argv[])
692 display_message = error_message;
694 @@ -228,14 +228,14 @@ static int do_search(char *searchword, i
695 printf("\n%s of %s %s\n%s",
696 label, partnames[pos], searchword, outbuf);
698 - if (morphword = morphstr(searchword, pos))
699 + if ((morphword = morphstr(searchword, pos)) != NULL)
701 outbuf = findtheinfo(morphword, pos, search, whichsense);
702 totsenses += wnresults.printcnt;
703 if (strlen(outbuf) > 0)
704 printf("\n%s of %s %s\n%s",
705 label, partnames[pos], morphword, outbuf);
706 - } while (morphword = morphstr(NULL, pos));
707 + } while ((morphword = morphstr(NULL, pos)) != NULL);