Skip to content

Commit

Permalink
a4091d: Fix for CID 331063 Untrusted pointer read
Browse files Browse the repository at this point in the history
  • Loading branch information
reinauer committed Jan 26, 2024
1 parent 401c74d commit 7f5cb6c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions a4091d.c
Original file line number Diff line number Diff line change
Expand Up @@ -1689,8 +1689,8 @@ main(int argc, char *argv[])
char *devname = DEVICE_NAME;

for (arg = 1; arg < argc; arg++) {
char *ptr = argv[arg];
if (*ptr == '-') {
if (*argv[arg] == '-') {
char *ptr = argv[arg];
while (*(++ptr) != '\0') {
switch (*ptr) {
case 'c':
Expand Down Expand Up @@ -1731,9 +1731,9 @@ main(int argc, char *argv[])
}
}
} else {
if ((sscanf(ptr, "%d%n", &unitno, &pos) != 1) ||
(ptr[pos] != '\0')) {
printf("Invalid unit '%s'\n", ptr);
if ((sscanf(argv[arg], "%d%n", &unitno, &pos) != 1) ||
(argv[arg][pos] != '\0')) {
printf("Invalid unit '%s'\n", argv[arg]);
usage();
exit(1);
}
Expand Down Expand Up @@ -1776,7 +1776,7 @@ main(int argc, char *argv[])
if (open_and_wait) {
int i;
printf("Device open; press enter to proceed.\n");
scanf("%d", &i);
(void)scanf("%d", &i);
}

ior = &tio->iotd_Req;
Expand Down

0 comments on commit 7f5cb6c

Please sign in to comment.