Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for various config initialization bugs due to invalid string comparisons #240

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ int count_nodes( xmlNode* root, const char* tag ) {
// iterate over all nodes at this level, checking for instances of 'tag'
int tagcnt = 0;
for ( ; root; root = root->next ) {
if ( root->type == XML_ELEMENT_NODE && strncmp( (char*)root->name, tag, strlen(tag) ) == 0 ) {
if ( root->type == XML_ELEMENT_NODE && strncmp( (char*)root->name, tag, strlen(tag) + 1 ) == 0 ) {
tagcnt++;
}
}
Expand All @@ -853,7 +853,7 @@ HASH_NODE* find_namespace( HASH_NODE* nslist, size_t nscount, const char* nsname
// iterate over the elements of the nslist, searching for a matching name
size_t index;
for( index = 0; index < nscount; index++ ) {
if( strncmp( nslist[index].name, nsname, strlen(nsname) ) == 0 ) {
if( strncmp( nslist[index].name, nsname, strlen(nsname) + 1 ) == 0 ) {
return ( nslist + index );
}
}
Expand All @@ -872,7 +872,7 @@ marfs_repo* find_repo( marfs_repo* repolist, int repocount, const char* reponame
// iterate over the elements of the repolist, searching for a matching name
int index;
for ( index = 0; index < repocount; index++ ) {
if ( strncmp( repolist[index].name, reponame, strlen(reponame) ) == 0 ) {
if ( strncmp( repolist[index].name, reponame, strlen(reponame) + 1 ) == 0 ) {
return ( repolist + index );
}
}
Expand Down
Loading