Bug #1004
closedjljvmregistry.cpp doesn't handle whitespace within values
0%
Description
specifically, this is where the problem happens in jljvmregistry.cpp, with line numbers:
162> ptr = s.c_str();
164> cout<<"jljvmregistry.cpp getPostResponse > copy: '" << ptr <<"'" <<endl;
165> sscanf(s.c_str(), "%s", c1);
166> cout<<"jljvmregistry.cpp getPostResponse > c1 now: '" << c1 <<"'" <<endl;
As an example, if the input to this code segment is the line:
'/acc:access/@xsi:schemaLocation=eml://ecoinformatics.org/access-2.0.0rc3 eml-
access.xsd'
(note the space), this is printed out OK by line 164, but after the sscanf on line 165, the
printout on line 166 gives :
'/acc:access/@xsi:schemaLocation=eml://ecoinformatics.org/access-2.0.0rc3'
(note the truncation)
...so it looks like the sscanf stops reading at the whitespace.
NOTES:
1) this whitespace may not be just spaces - it may contain carriage returns and/or
linefeeds. However, we still need to be able to handle these, say in the event of passing
a CDATA section.
2) may need to re-evaluate how we delimit between adjacent name=val pairs in the
cache file, since newline chars may be legal in the actual data.
Updated by John Harris over 21 years ago
This is an easy fix -- sscanf is being used incorrectly.
Updated by John Harris over 21 years ago
I've tested this and it seems to work on linux. Instead of using sscanf I am
casting char const * to a char *.