Suspicious code in pkgconf_fragment_should_munge() #152

Closed
opened 2017-10-16 10:57:24 +00:00 by karen-arutyunov · 1 comment
karen-arutyunov commented 2017-10-16 10:57:24 +00:00 (Migrated from github.com)

The loop over check_fragments array elements in pkgconf_fragment_should_munge() function looks either redundant or out of order. The strncmp() call inside the loop can never return 0 as its first argument (the string parameter) always starts with '/' character and the second (check_fragments[i].token) with '-', and so the loop can never end up returning true.

Also looks a bit strange that if the loop end up returning true, then the string that starts with an option (for example -isystem) would be prepended with the sysroot_dir (see pkgconf_fragment_munge()).

The loop over check_fragments array elements in pkgconf_fragment_should_munge() function looks either redundant or out of order. The strncmp() call inside the loop can never return 0 as its first argument (the string parameter) always starts with '/' character and the second (check_fragments[i].token) with '-', and so the loop can never end up returning true. Also looks a bit strange that if the loop end up returning true, then the string that starts with an option (for example -isystem) would be prepended with the sysroot_dir (see pkgconf_fragment_munge()).

It was there for historical reasons, it's obsolete now.

It was there for historical reasons, it's obsolete now.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#152
There is no content yet.