changeset 416:7b2dd0d4c366

Correct some really stupid fixed-length string stuff, including a genuine stack overflow that causes a crash on OS/X for certain colour 3d plot data.
author Chris Cannam
date Mon, 29 Sep 2014 13:27:13 +0100
parents 49d5e885f58e
children d62a622a0e40 8039c7352ae2 7a671befc76d 9876a1db566c
files audioio/AudioJACKTarget.cpp
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioJACKTarget.cpp	Wed Sep 24 10:00:56 2014 +0100
+++ b/audioio/AudioJACKTarget.cpp	Mon Sep 29 13:27:13 2014 +0100
@@ -367,11 +367,12 @@
 #endif
 
     while ((int)m_outputs.size() < channels) {
-	
-	char name[20];
+
+        const int namelen = 30;
+	char name[namelen];
 	jack_port_t *port;
 
-	sprintf(name, "out %d", int(m_outputs.size() + 1));
+	snprintf(name, namelen, "out %d", int(m_outputs.size() + 1));
 
 	port = jack_port_register(m_client,
 				  name,