argv buffer overflow? #206

Closed
opened 2021-01-07 19:34:00 +00:00 by jmoguillansky-gpsw · 0 comments
jmoguillansky-gpsw commented 2021-01-07 19:34:00 +00:00 (Migrated from github.com)

Hi,
in cli/main.c:

const char *package = argv[pkg_optind];

pkg_optind is initialized to 1 (in getopt_long.c).

What if argc is 1 (i.e. no params were passed, just the executable path)?
This may cause buffer overflow?
Should this be:
const char *package = (argc == 1) ? NULL : argv[pkg_optind];

Hi, in cli/main.c: const char *package = argv[pkg_optind]; pkg_optind is initialized to 1 (in getopt_long.c). What if argc is 1 (i.e. no params were passed, just the executable path)? This may cause buffer overflow? Should this be: const char *package = (argc == 1) ? NULL : argv[pkg_optind];
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#206
There is no content yet.