Bug#1122571: psmisc: Segmentation fault due to harmlessly stacked option parms

2025-12-12 Thread Oliver M. Schode
Package: psmisc
Version: 23.7-2
Followup-For: Bug #1122571

Hi Craig,

thanks for the quick feedback. I could not reproduce with any other
combination and suspected it must be due to that specific parameter's
positional handling. I've had a look now and sure enough, it's a
classic:

https://github.com/acg/psmisc/blob/master/src/killall.c#L824C1-L829C8

case 'V':
 /* option check is optind-1 but sig name is optind */
 if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) {
print_version();
return 0;
 }

The second strncmp does it since at this time and with the given opt
string, getopt would have advanced its internal pointer. Assuming
argv[optind-1] still holds the token is generally the wrong approach to
sort out whether short or long option is present.

- Oliver



Bug#1122571: psmisc: Segmentation fault due to harmlessly stacked option parms

2025-12-12 Thread Craig Small
On Fri, 12 Dec 2025 at 00:03, Oliver M. Schode 
wrote:

> $ killall -vV
>
> results in segmentation fault. I didn't try many other combinations
> after hitting on this accidentally, consider others may abort as well.
>
Hi Oliver,
  How strange, I can see it here too.
Have you been able to make it happen for anything except where the first
character is a valid option and the second is capital V?
 - Craig


Bug#1122571: psmisc: Segmentation fault due to harmlessly stacked option parms

2025-12-11 Thread Oliver M. Schode
Package: psmisc
Version: 23.7-2
Severity: normal
Tags: upstream

Dear Maintainer,

merely running

$ killall -vV

results in segmentation fault. I didn't try many other combinations
after hitting on this accidentally, consider others may abort as well.
Stacking "old style" options certainly works, even where otherwise
meaningless, such as

$ killall -vl

but the segfault should not happen in any case.


Regards,
Oliver