Blob Blame History Raw
From 00280570af529e4a54009bd5c6aeeab05286efcf Mon Sep 17 00:00:00 2001
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Date: Thu, 8 Mar 2012 21:54:22 +0100
Subject: [PATCH] Fix segfault in jack_connect

When jack_connect is called without any argument, it causes a segfault
in

                snprintf( portA, sizeof(portA), "%s", argv[argc-1] );
                snprintf( portB, sizeof(portB), "%s", argv[argc-2] );

Reported in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662199
---
 example-clients/connect.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/example-clients/connect.c b/example-clients/connect.c
index 5ed112b..0f4f8be 100644
--- a/example-clients/connect.c
+++ b/example-clients/connect.c
@@ -128,7 +128,10 @@ void port_connect_callback(jack_port_id_t a, jack_port_id_t b, int connect, void
 		return 1;
 	}
 
-	if (argc < 3) show_usage(my_name);
+	if (argc < 3) {
+		show_usage(my_name);
+		return 1;
+	}
 
 	/* try to become a client of the JACK server */
 
-- 
1.7.5.4