Submit #2717

Out of range numeric handling

Added by dclink 7 months ago. Updated 2 months ago.

Status:FeedbackStart date:08/22/2014
Priority:NormalDue date:
Assignee:tuxillo% Done:

0%

Category:Userland
Target version:4.2.x

Description

In a similar way than OpenBSD, the numeric values overflows are checked.

patch-atoi.txt Magnifier (16.4 KB) dclink, 08/24/2014 12:27 AM

History

#1 Updated by dclink 7 months ago

  • Subject changed from Sysctl out of range numeric handling handling to Sysctl out of range numeric handling
  • Status changed from New to Resolved

#2 Updated by dclink 7 months ago

  • Target version set to 3.9.x

#3 Updated by dclink 7 months ago

  • Status changed from Resolved to Feedback

#4 Updated by dclink 7 months ago

  • File deleted (diff-sysctl.c)

#5 Updated by dclink 7 months ago

  • File patch-atoi.txtMagnifier added
  • Subject changed from Sysctl out of range numeric handling to Out of range numeric handling
  • Category changed from Kernel to Userland

Finally made more out of range handling in some base utilities. For example vi with a wrong COLUMNS env var led to segmentation fault. Ported small fixes in ifconfig 80211 part from FreeBSD (use of d value instead of atoi(val) when it was necessary) and so on.

#6 Updated by tuxillo 2 months ago

  • Target version changed from 3.9.x to 4.2.x

Grab

#7 Updated by tuxillo 2 months ago

  • Assignee set to tuxillo
  • % Done changed from 100 to 0

Hi,

The patch looks okay besides a few wrong tabs which is really minor.
But I'd like to understand why you don't use strtonum() more consistently, for example you use strtol() and an ERANGE check in some other places:

- dtrwait = atoi(argv[3]);
+ dtrwait = strtol(argv[3], NULL, 10);
+ if (errno == ERANGE)
+ usage();

Cheers,
Antonio Huete

Also available in: Atom PDF