Markus-Go / ip-countryside

Creates an accurate ip-to-country database out of the RIR information.
Apache License 2.0
50 stars 15 forks source link

LINE_LENGTH too small at 2048 characters, program exits with vague error #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download version 0.2.1 of ip-countryside
2. Run ./getDBs.sh to fetch data
3. Run make to build createDb program
4. Run ./createDb program, some time will pass, and the following error will 
appear: Error reading ripe.db.inetnum file

What is the expected output? What do you see instead?

  An error appears.  Uncertain of the correct output.

What version of the product are you using? On what operating system?

  ip-countryside 0.2.1 on Linux 2.6.26-2-amd64 

Please provide any additional information below.

In parser.cpp at line 326, the error is output.  This happens when 
inDB.getline(cBuf,LINE_LENGTH) fails and I suspected that LINE_LENGTH was too 
small.  The value of LINE_LENGTH is defined in parser.h as 2048.  However, 
examining the latest ripe.db.inetnum.file revealed a maximum line length of 
2634 characters.  

By increasing LINE_LENGTH to 4096, running make clean && make, and rerunning 
./createDb, the program outputs "Program Terminated!" and appears to succeed 
(exit code 0).

--- parser.h    2010-07-17 12:53:04.000000000 -0700
+++ parser.h.orig   2010-07-17 12:52:53.000000000 -0700
@@ -37,7 +37,7 @@

 using namespace std;
-#define LINE_LENGTH 4096
+#define LINE_LENGTH 2048

 void dbParser( string dbIn , string delName, string dbOut );
 void delegParser( string , string );

Original issue reported on code.google.com by synaptic...@gmail.com on 18 Jul 2010 at 10:05

GoogleCodeExporter commented 9 years ago
Err, patch is reversed but you get the idea. :)

Original comment by synaptic...@gmail.com on 18 Jul 2010 at 10:06

GoogleCodeExporter commented 9 years ago
Thank you for pointing that out, code is fixed.

Original comment by goldstein.iupr on 25 Aug 2010 at 5:16