htdig: [Patch] Incorrect ExternalParser can kill htDig

Vadim Chekan (
Mon, 16 Nov 1998 16:26:11 +0200


I wrote my own external parser for WinWord document and done error in it.
External parser must write to stdout "w \t <3 parameters>". But if
parameters is less then 3 then Dig core dump. After debuging htdig.core i
found problem in source code. Function strtok return null if no more tokens.
But any chek don't done.

Vadim Chekan.

RCS file: /opt/htdig/cvs/htdig3/htdig/,v
retrieving revision 1.2
diff -u -p -r1.2
--- 1997/03/24 04:33:16 1.2
+++ 1998/11/16 14:27:27
@@ -156,7 +156,10 @@ ExternalParser::parse(Retriever &retriev
   token1 = strtok(0, "\t");
   token2 = strtok(0, "\t");
   token3 = strtok(0, "\t");
+if ( token1!=NULL & token2!=NULL & token3!=NULL )
   retriever.got_word(token1, atoi(token2), atoi(token3));
+cerr<< "External parser error in line:"<<line<<"\n";

      case 'u': // href

To unsubscribe from the htdig mailing list, send a message to containing the single word "unsubscribe" in
the body of the message.

This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:28:48 PST