From fd3a620a6872b0b5c6b7f51f790a0c2830564bcd Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Wed, 29 Aug 2012 18:21:05 +0100 Subject: [PATCH] dtsr: Resolve all -Wformat-security warnings. --- cde/programs/dtsr/dtsrcreate.c | 6 +++--- cde/programs/dtsr/dtsrdbrec.c | 2 +- cde/programs/dtsr/dtsrhan.c | 24 ++++++++++++------------ cde/programs/dtsr/huffcode.c | 10 +++++----- cde/programs/dtsr/tomita.c | 10 +++++----- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/cde/programs/dtsr/dtsrcreate.c b/cde/programs/dtsr/dtsrcreate.c index f1b22924..f5e81316 100644 --- a/cde/programs/dtsr/dtsrcreate.c +++ b/cde/programs/dtsr/dtsrcreate.c @@ -224,7 +224,7 @@ static int change_max_wordsize (char *new_size) /* Give user a final warning about large word sizes */ if (maxwordsz > STANDARD_MAXWORD && language != DtSrLaDEU && !quiet_mode) - printf (catgets (dtsearch_catd, MS_initausd, 10, + printf ("%s", catgets (dtsearch_catd, MS_initausd, 10, PROGNAME" Specifying large maximum word sizes may " "significantly\n increase storage requirements.\n")); return TRUE; @@ -262,7 +262,7 @@ static int change_min_wordsize (char *new_size) /* give user a warning about short word sizes */ if (minwordsz < DEFAULT_MINWORD) - printf (catgets (dtsearch_catd, MS_initausd, 9, + printf ("%s", catgets (dtsearch_catd, MS_initausd, 9, PROGNAME " Specifying small minimum word sizes" " may require extensive\n" " editing of stopword file to prevent significantly\n" @@ -800,7 +800,7 @@ DBD_OKAY: printf ("060*** fillnew dbrec.\n"); d_fillnew (OR_DBREC, &dbrec, 0); if (db_status != S_OKAY) { - printf (catgets (dtsearch_catd, MS_initausd, 509, + printf ("%s", catgets (dtsearch_catd, MS_initausd, 509, PROGNAME "509 Could not initialize database header record.\n")); puts (vista_msg (PROGNAME "510")); DtSearchExit (3); diff --git a/cde/programs/dtsr/dtsrdbrec.c b/cde/programs/dtsr/dtsrdbrec.c index 90d42a3b..800c7e5b 100644 --- a/cde/programs/dtsr/dtsrdbrec.c +++ b/cde/programs/dtsr/dtsrdbrec.c @@ -112,7 +112,7 @@ void print_dbrec (char *dbname, struct or_dbrec * dbrec) "Maximum object key size (sizeof(objkey)) is %ld bytes.\n"), DtSrMAX_DB_KEYSIZE); if (ORD_USEHUGEKEYS & dbrec->or_dbflags) - printf (catgets (dtsearch_catd, MS_dbrec, 4, + printf ("%s", catgets (dtsearch_catd, MS_dbrec, 4, "Optional 'Huge' keys enabled.\n")); printf (catgets (dtsearch_catd, MS_dbrec, 12, diff --git a/cde/programs/dtsr/dtsrhan.c b/cde/programs/dtsr/dtsrhan.c index e002aef7..b579b48a 100644 --- a/cde/programs/dtsr/dtsrhan.c +++ b/cde/programs/dtsr/dtsrhan.c @@ -339,7 +339,7 @@ void open_outfile () printf ( catgets(dtsearch_catd, MS_chandel, 3, "Output file '%s' already exists.\n") , outfile); - printf ( catgets(dtsearch_catd, MS_chandel, 4, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 4, "Append, overwrite, or quit? [a,o,q] ") ); i = tolower (getchar ()); @@ -1366,17 +1366,17 @@ BAD_ABSTR: /*---- Process tables, and check for identifiers referenced ----*/ if (!top_defined && !bot_defined) { bad_profile = TRUE; - printf ( catgets(dtsearch_catd, MS_chandel, 49, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 49, "Error - delimiter not defined.\n") ); } if (!key_defined) { bad_profile = TRUE; - printf ( catgets(dtsearch_catd, MS_chandel, 50, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 50, "Error - key-type character never defined.\n") ); } if (!key_pos_defined) { bad_profile = TRUE; - printf ( catgets(dtsearch_catd, MS_chandel, 51, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 51, "Error - key never defined.\n") ); } if (bad_profile) @@ -2223,7 +2223,7 @@ static void user_arg_processor (int argc, char **argv) case 'w': if ((screen_width = atoi (argptr + 2)) == 0) { - printf ( catgets(dtsearch_catd, MS_chandel, 72, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 72, "Invalid screen width specified.\n") ); bad_parm = TRUE; } @@ -2255,7 +2255,7 @@ static void user_arg_processor (int argc, char **argv) } /*--while--*/ if (argc-- <= 0) { - printf ( catgets(dtsearch_catd, MS_chandel, 77, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 77, "Missing required profile-file name.\n") ); bad_parm = TRUE; } @@ -2272,7 +2272,7 @@ static void user_arg_processor (int argc, char **argv) } if (argc-- <= 0) { - printf ( catgets(dtsearch_catd, MS_chandel, 78, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 78, "Missing required input-file name.\n") ); bad_parm = TRUE; } @@ -2290,7 +2290,7 @@ static void user_arg_processor (int argc, char **argv) strcat(outfile,EXT_FZKEY); *****************/ if (strcmp (infile, "-") == 0) { - printf ( catgets(dtsearch_catd, MS_chandel, 79, "Error - using " + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 79, "Error - using " "stdin as input, output filename is required!\n") ); exit (FILE_ERROR); } else { @@ -2341,13 +2341,13 @@ static void user_arg_processor (int argc, char **argv) printf ( catgets(dtsearch_catd, MS_chandel, 83, " Profile file: %s\n") , profile); if (strcmp (infile, "-") == 0) - printf ( catgets(dtsearch_catd, MS_chandel, 84, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 84, " Input file: stdin\n") ); else printf ( catgets(dtsearch_catd, MS_chandel, 85, " Input file: %s\n") , infile); if (strcmp (outfile, "-") == 0) - printf ( catgets(dtsearch_catd, MS_chandel, 86, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 86, " Output file: stdout\n") ); else printf ( catgets(dtsearch_catd, MS_chandel, 87, @@ -2405,13 +2405,13 @@ int main (int argc, char **argv) oops = fclose (outstream); fclose (instream); if (oops < 0) { - printf ( catgets(dtsearch_catd, MS_chandel, 90, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 90, "\nError closing output file - disk full?\n") ); exit (FILE_ERROR); } } else { - printf ( catgets(dtsearch_catd, MS_chandel, 91, + printf ( "%s", catgets(dtsearch_catd, MS_chandel, 91, "Quitting due to errors in profile file.\n") ); exit (BAD_PROFILE); } diff --git a/cde/programs/dtsr/huffcode.c b/cde/programs/dtsr/huffcode.c index 8e7278b6..56e5fc99 100644 --- a/cde/programs/dtsr/huffcode.c +++ b/cde/programs/dtsr/huffcode.c @@ -265,14 +265,14 @@ static int build_tree (void) * tree level, quit. */ if (hctree1[i].sort > MAX_BITLEN) { - fprintf (stderr, catgets(dtsearch_catd, MS_huff, 30, + fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 30, "\n183 Bit strings have grown too large. You probably " "have literals\n turned off with grossly unbalanced " "character counts.\n\7")); exit (2); } if (hctree1[curr].count >= total_count) { - fprintf (stderr, catgets(dtsearch_catd, MS_huff, 31, + fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 31, "\n191 Programming Error: Still trying to build\n" " Huffman Code Tree after root created.\n\7")); exit (2); @@ -583,7 +583,7 @@ static void huffman_code (time_t idstamp) bit_string + 1, /* hop over LAST_BIT */ hctree1[i].count, char_label (i)); - fprintf (outstream_huf, sprintbuf); + fprintf (outstream_huf, "%s", sprintbuf); } /* end forloop printing out each tree base entry */ @@ -669,7 +669,7 @@ static void user_args_processor (int argc, char **argv) /* test for required tree file name */ if (argc <= 0) { - fprintf (stderr, catgets(dtsearch_catd, MS_huff, 37, + fprintf (stderr, "%s", catgets(dtsearch_catd, MS_huff, 37, "576 Missing Huffman Code file names prefix.\n")); print_usage (); exit (2); @@ -735,7 +735,7 @@ int main (int argc, char *argv[]) /* initialize tree table, using the table file if it exists */ init_treebase (); if (total_count == 0L) - printf (catgets(dtsearch_catd, MS_huff, 41, + printf ("%s", catgets(dtsearch_catd, MS_huff, 41, "Huffman Code Tables will be newly created.\n")); else printf (catgets(dtsearch_catd, MS_huff, 42, diff --git a/cde/programs/dtsr/tomita.c b/cde/programs/dtsr/tomita.c index 9e17c500..91aad3ba 100644 --- a/cde/programs/dtsr/tomita.c +++ b/cde/programs/dtsr/tomita.c @@ -196,7 +196,7 @@ static int change_database (char *newname) return FALSE; /* If browsing, tell user his options */ - fprintf (aa_stderr, catgets(dtsearch_catd, MS_tomita, 5, + fprintf (aa_stderr, "%s", catgets(dtsearch_catd, MS_tomita, 5, "Available choices are:") ); for (db = usrblk.dblist; db != NULL; db = db->link) fprintf (aa_stderr, " '%s'", db->name); @@ -422,7 +422,7 @@ static int browser (void) continue; default: - printf (catgets(dtsearch_catd, MS_tomita, 16, "...what?\n")); + printf ("%s", catgets(dtsearch_catd, MS_tomita, 16, "...what?\n")); continue; } /* end switch */ @@ -471,7 +471,7 @@ DISPLAY_RECORD: if (pausing && *ptr == '\n') { if (++pause_counter >= PAUSE_ROWS) { /* Msg 21 is used in two places */ - printf ( catgets(dtsearch_catd, MS_tomita, 21, + printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21, "\n...push ENTER to continue... ") ); *userbuf = '\0'; @@ -500,7 +500,7 @@ DISPLAY_RECORD: if (pausing && *ptr == '\n') if (++pause_counter >= PAUSE_ROWS) { /* Msg 21 is used in two places */ - printf ( catgets(dtsearch_catd, MS_tomita, 21, + printf ( "%s", catgets(dtsearch_catd, MS_tomita, 21, "\n...push ENTER to continue... ") ); *userbuf = '\0'; @@ -920,7 +920,7 @@ BAD_ARGS: usrblk.request = OE_SHUTDOWN; Opera_Engine (); - printf ( catgets(dtsearch_catd, MS_tomita, 36, + printf ( "%s", catgets(dtsearch_catd, MS_tomita, 36, "Normal engine shutdown.\n") ); DtSearchExit (0); } /* main() */ -- 2.25.1