Gordon Ross wrote: > Having ported a bunch of code with str==NULL problems, > my observation is that the most common situation is the > assumption that: > str=NULL is treated as str="" > Not only in printf (and friends: vprintf...) > but also in the str* functions. > > The team I was working with at the time didn't want to > just link 0 at 0 with the application because we wanted to > find out about other uses of bad pointers. So instead, > the approach we used was to provide wrappers that allow > str=NULL to be treated as str="". It's not hard to do > for the str* functions, but is rather tricky for printf > because you have to walk the format string in the wrapper. > > One suggestion I have here would be to provide some sort of > "shim" library that these (arguably broken) applications > can link with that does the null string ptr substitutions. > Maybe the printf internals (doprnt?) could call some > function for %s that the "shim" can substitute?
I'm not interested in doing that as part of this case. None of the other platforms have this and I just don't see the point in doing that. DTrace can be used to find the cases where NULL is passed where it would currently cause a SEGV on Solaris but won't on our competitors platforms. Lets just end the madness of Solaris being different and get over the purity aspects of this. This case is about making Solaris/OpenSolaris familiar and attractive for developers and users and that means doing what all the other kids on the block do nothing more and nothing less. -- Darren J Moffat
