On 6/25/08, Darren J Moffat <darrenm at sac.sfbay.sun.com> wrote: > > Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI > This information is Copyright 2008 Sun Microsystems > 1. Introduction > 1.1. Project/Component Working Name: > libc printf behaviour for NULL string > 1.2. Name of Document Author/Supplier: > Author: Darren Moffat > 1.3 Date of This Document: > 25 June, 2008 > 4. Technical Description > > Background > ---------- > The current behavior of the printf(3C) family of functions in libc when > passed a NULL value for a string format is undefined and usually > results in a SEGV and crashed application. > > The workaround to applications written to depend on this behavior is to > LD_PRELOAD=/usr/lib/0 at 0.so.1 (or the 64 bit equivalent). The > workaround isn't always easy to apply (or it is too late data has been > lost or corrupted by that point). > > Some will often state, myself included, that you shouldn't assume that > the printf(3C) family will deal with a NULL argument for a string and > that arguments should be checked before calling printf(3C). > > The behavior of the SunOS 4.x printf(3C) and that of the still shipping > binary compatibility library /usr/4lib/libc.so.1 was to use the string > "(null)" if the argument for a %s was NULL.
The string "(null)" needs to be localised like in Linux, i.e. LC_ALL=de_AT.utf8 must print "(nichts)". Jenny -- Jennifer Pioch, Uni Frankfurt
