mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
Coverity 1264406; char array being compared against NULL. Replaced with a strlen check for the value.
This commit is contained in:
parent
f1dcdde045
commit
9cc5898931
20
oc2/ocrc.c
20
oc2/ocrc.c
@ -724,18 +724,18 @@ ocrc_triple_iterate(char* key, char* url, struct OCTriple* prev)
|
||||
{
|
||||
struct OCTriple* next;
|
||||
if(prev == NULL)
|
||||
next = ocrc_locate(key,url);
|
||||
next = ocrc_locate(key,url);
|
||||
else
|
||||
next = prev+1;
|
||||
next = prev+1;
|
||||
if(next == NULL)
|
||||
return NULL;
|
||||
for(;next->key != NULL;next++) {
|
||||
/* See if key as prefix still matches */
|
||||
int cmp = strcmp(key,next->key);
|
||||
if(cmp != 0) {next = NULL; break;} /* key mismatch */
|
||||
/* compare url */
|
||||
cmp = ocstrncmp(url,next->host,strlen(next->host));
|
||||
if(cmp == 0) break;
|
||||
return NULL;
|
||||
for(; strlen(next->key) > 0; next++) {
|
||||
/* See if key as prefix still matches */
|
||||
int cmp = strcmp(key,next->key);
|
||||
if(cmp != 0) {next = NULL; break;} /* key mismatch */
|
||||
/* compare url */
|
||||
cmp = ocstrncmp(url,next->host,strlen(next->host));
|
||||
if(cmp == 0) break;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user