Format String issue w/ patch

"Roman Hunt" <[email protected]> Tue, 12 Nov 2002 15:42:08 -0500
Newsgroups gmane.comp.gnu.octal.devel
Message-ID <[email protected]>
This is a multi-part MIME message

--_===168078====amicapital.com===_
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 8bit

octal-dev@:
   In my initial grok of the tree I noticed a bit of 
obfuscation.  I have created a patch to try to minimize 
core dumps in the octal engine itself witch might be 
caused by not fully understanding the internals of an 
important octal function.  I have tried to go through the 
tree and preserve the proper desired output of the 
function authors but as always things should be double 
checked.  (NOTE: I have sent this through a webmail system 
I built. This _may_ have munged the patch '\n' -> CRLF 
type stuff) let me know if this has occured and I will 
resend from a standard UNIX mailer. Have a good day.

-roman


   --- the forwarded message follows ---

--_===168078====amicapital.com===_
Content-Type: message/rfc822

Return-Path: <[email protected]>
Received: from [192.168.4.12] (HELO spectre.amicapital.com)
  by amicapital.com (CommuniGate Pro SMTP 3.5.9)
  with ESMTP-TLS id 167815 for [email protected]; Tue, 12 Nov 2002 14:27:34 -0500
Received: from spectre.amicapital.com ([email protected] [127.0.0.1])
	by spectre.amicapital.com (8.12.6/8.12.6) with ESMTP id gACJMuNY012651
	for <[email protected]>; Tue, 12 Nov 2002 14:22:56 -0500 (EST)
Received: (from roman@localhost)
	by spectre.amicapital.com (8.12.6/8.12.6/Submit) id gACJMuUl024457
	for [email protected]; Tue, 12 Nov 2002 14:22:56 -0500 (EST)
Date: Tue, 12 Nov 2002 14:22:56 -0500 (EST)
From: Roman Hunt <[email protected]>
Message-Id: <[email protected]>
To: [email protected]
Subject: patch

Index: machine.c
===================================================================
RCS file: /cvsroot/octal/octal/machine.c,v
retrieving revision 1.11
diff -u -r1.11 machine.c
--- machine.c	13 Jul 2001 09:45:15 -0000	1.11
+++ machine.c	12 Nov 2002 18:59:20 -0000
@@ -80,10 +80,10 @@
 		num_types = ix; 
 	}
   
-	else ox_die("%%OCTAL: Couldn't open machine_dir during call to load_type_registry() \n");
+	else ox_die("%OCTAL: Couldn't open machine_dir during call to load_type_registry() \n");
 
 	if (ix == 0)
-		ox_die("%%OCTAL: No machines found.");
+		ox_die("%OCTAL: No machines found.");
 
 	// PRINT BRIEF REPORT ABOUT MACHINES LOADED
 
@@ -102,7 +102,7 @@
 {
 	int i;
 
-	if (!num_types) ox_die("%%OCTAL: No machine types loaded. \n");
+	if (!num_types) ox_die("%OCTAL: No machine types loaded. \n");
   
 	for (i=0; i<num_types; i++) {
 		if (strcmp(name, type_registry[i].short_name) == 0)
@@ -239,7 +239,7 @@
 	mc_allocate_outbuf(m, &m->lout, &m->rout); 
 
 	if (!m->rout || !m->lout)
-		ox_die("%%OCTAL: Memory allocation failed during create_machine()\n");
+		ox_die("%OCTAL: Memory allocation failed during create_machine()\n");
 
 	return m; 
 }
Index: octal.c
===================================================================
RCS file: /cvsroot/octal/octal/octal.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 octal.c
--- octal.c	7 Mar 2001 03:18:12 -0000	1.1.1.1
+++ octal.c	12 Nov 2002 18:59:20 -0000
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 
 void ox_die(const char* message) {
-  fprintf(stderr, message);
+  fprintf(stderr, "%s", message);
   exit(-1);
 }
 
Index: output.c
===================================================================
RCS file: /cvsroot/octal/octal/output.c,v
retrieving revision 1.2
diff -u -r1.2 output.c
--- output.c	11 Mar 2001 02:08:03 -0000	1.2
+++ output.c	12 Nov 2002 18:59:20 -0000
@@ -103,10 +103,10 @@
 	int opos = 0;
 
   	if (!buffer) 
-		ox_die("%%%%OCTAL: No output buffer in sound driver.\n");
+		ox_die("%%OCTAL: No output buffer in sound driver.\n");
    
 	if (sound_fd == -1) 
-		ox_die("%%%%OCTAL: No sound device open.\n ");
+		ox_die("%%OCTAL: No sound device open.\n ");
   	  
 	// now convert from OCTAL's sample format to the soundcard's. 
 

--_===168078====amicapital.com===_--