mirror of
https://github.com/ipxe/ipxe
synced 2025-12-15 09:04:37 +03:00
[settings] Fix setting_cmp() to handle nameless settings
setting_cmp() compares by option tag and then by name. Empty names will always match, which gives us a false positive. Fix by explicitly checking for empty names. Modified-by: Michael Brown <mcb30@etherboot.org> Signed-off-by: Michael Brown <mcb30@etherboot.org>
This commit is contained in:
committed by
Michael Brown
parent
edfbd4e4fa
commit
68973f1c49
@@ -782,8 +782,12 @@ int setting_cmp ( struct setting *a, struct setting *b ) {
|
|||||||
if ( a->tag && ( a->tag == b->tag ) )
|
if ( a->tag && ( a->tag == b->tag ) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Otherwise, compare the names */
|
/* Otherwise, if the settings have names, compare them */
|
||||||
return strcmp ( a->name, b->name );
|
if ( a->name && b->name && a->name[0] )
|
||||||
|
return strcmp ( a->name, b->name );
|
||||||
|
|
||||||
|
/* Otherwise, return a non-match */
|
||||||
|
return ( ! 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user