Skip to content

Commit

Permalink
Merge pull request #723 from niukuo/master
Browse files Browse the repository at this point in the history
fix wrong length in remote schema
  • Loading branch information
miloyip committed Sep 1, 2016
2 parents 9bd618f + 250cf66 commit cdb3454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ class GenericSchemaDocument {

if (i > 0) { // Remote reference, resolve immediately
if (remoteProvider_) {
if (const GenericSchemaDocument* remoteDocument = remoteProvider_->GetRemoteDocument(s, i - 1)) {
if (const GenericSchemaDocument* remoteDocument = remoteProvider_->GetRemoteDocument(s, i)) {
PointerType pointer(&s[i], len - i, allocator_);
if (pointer.IsValid()) {
if (const SchemaType* sc = remoteDocument->GetSchema(pointer)) {
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/schematest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ class RemoteSchemaDocumentProvider : public IGenericRemoteSchemaDocumentProvider
};

for (size_t i = 0; i < kCount; i++)
if (strncmp(uri, uris[i], length) == 0)
if (strncmp(uri, uris[i], length) == 0 && strlen(uris[i]) == length)
return sd_[i];
return 0;
}
Expand Down

0 comments on commit cdb3454

Please sign in to comment.