[PATCH] Fix is_valid_section_name always returning true
Submitted by Albert Astals Cid
Assigned to D-Bus Maintainers
Link to original bug (#106183)
Description
Created attachment 138992 The said patch
The if condition was
if (!((*name >= 'A' && *name <= 'Z') || (*name >= 'a' || *name <= 'z') || *name == '\n' || *name == '\t'))
which translates to
if ((!(*name >= 'A' && *name <= 'Z') && !(*name >= 'a' || *name <= 'z') && *name != '\n' && *name != '\t'))
which translates to
if (((*name < 'A' || *name > 'Z') && (*name < 'a' && *name > 'z') && *name != '\n' && *name != '\t'))
which will always be false since name can't be both smaller than a and bigger than z
Found by gcc
Patch 138992, "The said patch":
0001-Fix-is_valid_section_name-always-returning-true.patch
Version: git master