octal-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Format String issue w/ patch


From: Roman Hunt
Subject: Format String issue w/ patch
Date: Tue Nov 12 15:59:06 2002

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 ---
--- Begin Message --- Subject: patch Date: Tue, 12 Nov 2002 14:22:56 -0500 (EST)
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. 
 

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]