rdmenezes / synecdoche

Automatically exported from code.google.com/p/synecdoche
GNU Lesser General Public License v3.0
0 stars 0 forks source link

SCHEDULER_OP::parse_master_file needs cleanup #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SCHEDULER_OP::parse_master_file in client/scheduler_op.C uses char arrays 
and pointer trickery to do its parsing. It uses a std::string when taking 
the URL out of the <scheduler> tag, but uses C string functions to find 
the <scheduler>. There don't seem to be chances of buffer overflows, but 
we all know that kind of fixed-size arrays on the stack aren't "clean 
code"...

There is also the limitation that a line in the parsed HTML file can't be 
longer than 256 characters, because it reads 256-char lines at a time. If 
lines are longer, this function may fail to parse the scheduler URLs.

Unfortunately, the only way to read arbitrary-sized lines from a FILE* is 
using getline() (a GNU libc extension), or manually reading single 
characters or bigger chunks, searching for a newline, and appending the 
characters/chunks into a std::string. So I think this code should be 
modified to use std::getline on a std::ifstream instead.

(and for the far future... it should be parsed in-memory while it 
downloads, not using a temporary file; but that's a whole different 
issue!)

Original issue reported on code.google.com by nicolas....@gmail.com on 28 Jan 2009 at 12:25

GoogleCodeExporter commented 9 years ago

Original comment by DerMeister667@googlemail.com on 1 Mar 2009 at 6:34

GoogleCodeExporter commented 9 years ago

Original comment by nicolas....@gmail.com on 20 Apr 2009 at 5:38

GoogleCodeExporter commented 9 years ago

Original comment by DerMeister667@googlemail.com on 25 Apr 2009 at 9:12

GoogleCodeExporter commented 9 years ago
Fixed in r744.

Original comment by DerMeister667@googlemail.com on 25 Apr 2009 at 9:42

GoogleCodeExporter commented 9 years ago

Original comment by didacty...@gmail.com on 27 Jun 2009 at 1:32