[hackers] [ubase] Fix segfault in killall5 without -o || sin
 
commit 11d2d1faaf9cd0e2b6796c17390137dedcdc90bb
Author:     sin <sin_AT_2f30.org>
AuthorDate: Sat Jun 30 17:31:53 2018 +0100
Commit:     sin <sin_AT_2f30.org>
CommitDate: Sat Jun 30 17:31:53 2018 +0100
    Fix segfault in killall5 without -o
    
    Original patch by Platon Ryzhikov <ihummer63_AT_yandex.ru>
diff --git a/killall5.c b/killall5.c
index 14790b9..f3541f5 100644
--- a/killall5.c
+++ b/killall5.c
_AT_@ -73,10 +73,12 @@ main(int argc, char *argv[])
 
         SLIST_INIT(&omitpid_head);
 
-	for (p = strtok(arg, ","); p; p = strtok(NULL, ",")) {
-		pe = emalloc(sizeof(*pe));
-		pe->pid = estrtol(p, 10);
-		SLIST_INSERT_HEAD(&omitpid_head, pe, entry);
+	if (oflag) {
+		for (p = strtok(arg, ","); p; p = strtok(NULL, ",")) {
+			pe = emalloc(sizeof(*pe));
+			pe->pid = estrtol(p, 10);
+			SLIST_INSERT_HEAD(&omitpid_head, pe, entry);
+		}
         }
 
         if (sig != SIGSTOP && sig != SIGCONT)
Received on Sat Jun 30 2018 - 18:32:15 CEST
This archive was generated by hypermail 2.3.0
: Sat Jun 30 2018 - 18:36:26 CEST