Ralph, If preserved at all, the existing code should probably be made to act more intelligently when it encounters an unknown escape code. I would suggest advancing the length by some value (say 128?) that should be "big enough" and printing a prominent warning. So, the next time this bug surfaces it will be (a) non-fatal and (b) easy to pin down.
-Paul On Fri, Dec 12, 2014 at 5:46 PM, Ralph Castain <r...@open-mpi.org> wrote: > Looking at the comments in the code, it appears that the rationale when > written was to provide support for REALLY ancient systems that didn't have > some of these functions. Since that time, we added a configure check for > vsnprintf, so I'm adding Paul/Larry's suggested code, protected by that > configure. > > Since I suspect the configure check will always pass on any system of > interest today, I think this will solve the problem. We can then address > the broader question (e.g., do we even need this stuff any more at all?) in > a more leisurely way. > > > On Dec 12, 2014, at 5:42 PM, Larry Baker <ba...@usgs.gov> wrote: > > On 12 Dec 2014, at 5:22 PM, Paul Hargrove wrote: > > HOWEVER, while the patch catches the "%u" case, there are plenty of > potential ways to hit the same problem if, for instance, one uses "%zu" for > size_t. Additionally, I've already noted that the code for "%ld", "%lx", > "%lX", "%lf" are all currently incorrect. > > > Not sure if it is applicable, but C99 has an <inttypes.h> header which > #include's <stdint.h> and provides additional capabilities, such as > printf()/scanf() format macros for the types defined in <stdint.h>. > > Larry Baker > US Geological Survey > 650-329-5608 > ba...@usgs.gov > > > -- Paul H. Hargrove phhargr...@lbl.gov Computer Languages & Systems Software (CLaSS) Group Computer Science Department Tel: +1-510-495-2352 Lawrence Berkeley National Laboratory Fax: +1-510-486-6900