void-packages/srcpkgs/runit/patches/chpst.patch

15 lines
473 B
Diff

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;