runit: fix -n parsing in chpst.

This commit is contained in:
Leah Neukirchen 2022-12-11 18:37:45 +01:00
parent b8a0c40c38
commit fba58d92a5
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,14 @@
Fix UB which breaks -n with negative values.
Ensure optarg is incremented strictly before it is read from.
--- runit-2.1.2/src/chpst.c.orig
+++ runit-2.1.2/src/chpst.c
@@ -308,7 +308,7 @@
case 'n':
switch (*optarg) {
case '-':
- if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul;
+ ++optarg; if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
nicelvl *=-1;
break;
case '+': ++optarg;

View File

@ -1,7 +1,7 @@
# Template file for 'runit'
pkgname=runit
version=2.1.2
revision=12
revision=13
build_wrksrc="${pkgname}-${version}/src"
build_style="gnu-makefile"
short_desc="UNIX init scheme with service supervision"