Project

General

Profile

Bug #1004

jljvmregistry.cpp doesn't handle whitespace within values

Added by Matthew Brooke over 17 years ago. Updated over 17 years ago.

Status:
Resolved
Priority:
Immediate
Assignee:
Category:
jalama-general
Target version:
Start date:
02/27/2003
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
1004

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.

History

#1 Updated by John Harris over 17 years ago

This is an easy fix -- sscanf is being used incorrectly.

#2 Updated by John Harris over 17 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 *.

#3 Updated by Redmine Admin over 7 years ago

Original Bugzilla ID was 1004

Also available in: Atom PDF