From 5e537bfcc5f10040e9ee87acbdfd1a9570ef60e7 Mon Sep 17 00:00:00 2001 From: Matthias Varnholt Date: Wed, 27 Mar 2024 08:14:36 +0100 Subject: [PATCH] allow gaps in presentation context config --- dcmnet/libsrc/dcasccff.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dcmnet/libsrc/dcasccff.cc b/dcmnet/libsrc/dcasccff.cc index 658a251213..dd33762839 100644 --- a/dcmnet/libsrc/dcasccff.cc +++ b/dcmnet/libsrc/dcasccff.cc @@ -141,7 +141,6 @@ OFCondition DcmAssociationConfigurationFile::parsePresentationContexts( char buf[64]; unsigned int counter; - OFBool found; const char *key = NULL; const char *value = NULL; OFString abstractSyntaxUID; @@ -149,6 +148,7 @@ OFCondition DcmAssociationConfigurationFile::parsePresentationContexts( size_t separator = 0; size_t i; size_t len; + size_t max_state_count = 512; unsigned char c; OFCondition result = EC_Normal; @@ -157,8 +157,8 @@ OFCondition DcmAssociationConfigurationFile::parsePresentationContexts( { key = config.get_keyword(1); counter = 0; - found = OFTrue; - while (found) + + while (counter < max_state_count) { sprintf(buf, "%s%u", L0_PRESENTATIONCONTEXT_X, ++counter); value = config.get_entry(buf); @@ -189,9 +189,11 @@ OFCondition DcmAssociationConfigurationFile::parsePresentationContexts( abstractSyntaxUID.erase(separator); result = cfg.addPresentationContext(key, abstractSyntaxUID.c_str(), transferSyntaxKey.c_str(), scuMode); - if (result.bad()) return result; - - } else found = OFFalse; + if (result.bad()) + { + return result; + } + } } config.next_section(1); }