Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c, comp.std.c |
| Subject | Re: Customizing printf |
| Followup-To | comp.lang.c |
| Date | 2011-11-21 23:06 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20111121145051.881@kylheku.com> (permalink) |
| References | <j9tps6$nc9$1@speranza.aioe.org> <87vcql1cl1.fsf@blp.benpfaff.org> <jab5gl$b6p$1@reader1.panix.com> <87ipmehbxl.fsf@blp.benpfaff.org> <jaej0f$bg5$1@reader1.panix.com> |
Cross-posted to 2 groups.
Followups directed to: comp.lang.c
On 2011-11-21, Joe keane <jgk@panix.com> wrote: > That makes it worse! > > At least if the format string is compile-time constant, the compiler > -could- help you out. It's not obligated to do this check, and C offers Indeed. A C format string is a form of code, so if you have translators writing format strings, they are coding. > If the format string is read from a file, then God help you... Suppose you had a translations file with records containing the original format strings, and translated ones. A checker, invoked at build time, could validate that every record in the file contains only equivalent format strings (that differ only in their template text, not in the conversion specifiers). Furthermore, the checker would generate, from this file, a C header file which contains #define for nominal format strings (untranslated entries in English or whatever your development team's common language is). These #defines are used for writing the printf statements; they supply real string-literal format strings. Except these go to a printf wrapper which substitutes the translated text. The printf wrapper is endowed with the special GCC annotation so that the printf argument checking is applied to it at compile time. The translated text is pulled from some data structure which is also generated by the checker, in addition to that header file. > [core dump] That's the good case. The bad case is someone turns it into an exploitable security hole.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Customizing printf jacob navia <jacob@spamsink.net> - 2011-11-15 14:36 +0100
Re: Customizing printf "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-11-15 13:07 -0500
Re: Customizing printf Ben Pfaff <blp@cs.stanford.edu> - 2011-11-15 10:10 -0800
Re: Customizing printf jacob navia <jacob@spamsink.net> - 2011-11-15 21:36 +0100
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-15 12:51 -0800
Re: Customizing printf "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-11-15 18:03 -0500
Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-20 15:14 +0000
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 10:43 -0800
Re: Customizing printf Lauri Alanko <la@iki.fi> - 2011-11-20 19:01 +0000
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 11:05 -0800
Re: Customizing printf Dag-Erling Smørgrav <des@des.no> - 2011-11-20 20:38 +0100
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-20 11:37 -0800
Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-21 22:23 +0000
Re: Customizing printf Ian Collins <ian-news@hotmail.com> - 2011-11-22 11:26 +1300
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-21 14:23 -0800
Re: Customizing printf Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 23:06 +0000
Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-23 00:09 +0000
Re: Customizing printf blp@cs.stanford.edu (Ben Pfaff) - 2011-11-22 16:16 -0800
Re: Customizing printf Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-21 05:29 -0800
Re: Customizing printf jgk@panix.com (Joe keane) - 2011-11-21 22:50 +0000
Re: Customizing printf Lowell Gilbert <lgusenet@be-well.ilk.org> - 2011-11-15 13:13 -0500
Re: Customizing printf "-.-" <none@none.none> - 2011-11-16 14:06 +0100
Re: Customizing printf gazelle@shell.xmission.com (Kenny McCormack) - 2011-11-16 13:40 +0000
Re: Customizing printf Seebs <usenet-nospam@seebs.net> - 2011-11-16 20:18 +0000
Re: Customizing printf Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-17 07:54 +0200
csiph-web