diff --git a/sys-utils/ipcmk.c b/sys-utils/ipcmk.c index 0a84be77e..d6e5ce6c9 100644 --- a/sys-utils/ipcmk.c +++ b/sys-utils/ipcmk.c @@ -122,9 +122,14 @@ int main(int argc, char **argv) ask_sem = 1; break; case 'p': + { + char *end = NULL; + errno = 0; permission = strtoul(optarg, NULL, 8); + if (errno || optarg == end || (end && *end)) + err(EXIT_FAILURE, _("failed to parse mode")); break; - + } case 'h': usage(); case 'V': diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c index 5a27b7d20..52768a242 100644 --- a/sys-utils/ipcrm.c +++ b/sys-utils/ipcrm.c @@ -125,12 +125,13 @@ static int remove_id(int type, int iskey, int id) static int remove_arg_list(type_id type, int argc, char **argv) { int id; - char *end; + char *end = NULL; int nb_errors = 0; do { + errno = 0; id = strtoul(argv[0], &end, 10); - if (*end != 0) { + if (errno || !end || *end != 0) { warnx(_("invalid id: %s"), argv[0]); nb_errors++; } else {