diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-03-26 21:20:43 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2007-03-26 21:20:43 (GMT) |
commit | 7aaf40e9f9c2d200f5a9c8bee646c0741b9cea49 (patch) | |
tree | eec6ea4640a6e7bc4d11a11ec0aaf8780c5f607b /hl/src | |
parent | dde381add4e4bd4e03812ce8a5b678185d6296b7 (diff) | |
download | hdf5-7aaf40e9f9c2d200f5a9c8bee646c0741b9cea49.zip hdf5-7aaf40e9f9c2d200f5a9c8bee646c0741b9cea49.tar.gz hdf5-7aaf40e9f9c2d200f5a9c8bee646c0741b9cea49.tar.bz2 |
[svn-r13546]
Bug fix
The H5TB_find_field function was not correctly finding a string field name amongst a string list of parameters of field names in cases where the name is similar up to n characters.
Solution: added an extra verify condition with the string length
Tested: kagiso, simple fix
Diffstat (limited to 'hl/src')
-rw-r--r-- | hl/src/H5TB.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 1e055da..8f9eb07 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -3457,18 +3457,22 @@ out: static int H5TB_find_field( const char *field, const char *field_list ) { - const char *start = field_list; - const char *end; - - while ( (end = strstr( start, "," )) != 0 ) { - if ( strncmp(start,field,(size_t)(end-start)) == 0 ) return 1; - start = end + 1; - } - - if ( strcmp( start, field ) == 0 ) return 1; - - return -1; - + const char *start = field_list; + const char *end; + + while ( (end = strstr( start, "," )) != 0 ) + { + size_t count = end - start; + if ( strncmp(start, field, count) == 0 && count == strlen(field) ) + return 1; + start = end + 1; + } + + if ( strcmp( start, field ) == 0 ) + return 1; + + return -1; + } |