If you send a C-Find or C-Move request for SOP Instance UID
1.2.840.123 and 1.2.840.444
to a imagectn server with a database containing SOP Instance UID:
1.2.840.1
1.2.840.12
1.2.840.123
You will find/move SOP Instance UIDs:
1.2.840.1
1.2.840.12
1.2.840.123
The problem seems to be in the DB_MatchUID function in the dbfind.cc file:
Code: Select all
/*** UID List comparaison.
*** Match is successful if uid is found in model
**/
match = OFFalse ; ;
for (pc = modl ; *pc ; ) {
if (strncmp (pc, uid, strlen (uid)) == 0) {
match = OFTrue ;
break ;
}
else {
pc = strchr (pc, '\\') ;
if (pc == NULL)
break ;
else
pc++ ;
}
}
For instance the uid 1.2.840.1 will be compared with the nine first
characters in 1.2.840.123 which is equal to 1.2.840.1.
DB_MatchUID will therefore report true even if the uids is not identical.
A solution to the problem could be:
Code: Select all
/*** UID List comparaison.
*** Match is successful if uid is found in model
**/
match = OFFalse ; ;
for (pc = modl ; *pc ; ) {
/*
* Calculate the length to next '\'-sign
* if no '\'-sign the length of pc is returned
*/
unsigned int length = strcspn(pc, "\\");
if ( (lenth == strlen(uid)) &&
strncmp (pc, uid, length) == 0) {
match = OFTrue ;
break ;
}
else {
pc = strchr (pc, '\\') ;
if (pc == NULL)
break ;
else
pc++ ;
}
}
Is there an alternative solution to the problem?