Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!ucsfcgl!cca.ucsf.edu!rk9005 From: rk9005@cca.ucsf.edu (Roland McGrath) Newsgroups: comp.lang.c Subject: Re: vsprintf considered dangerous Message-ID: <1219@ucsfcca.ucsf.edu> Date: 4 Apr 88 02:30:07 GMT References: <36@lotus.UUCP> Reply-To: roland@rtsg.lbl.gov (Roland McGrath) Organization: Hackers Anonymous International, Ltd., Inc. (Applications welcome) Lines: 12 The GNU C library has such a function. It's called "vsnprintf" and it takes a maximum-length argument (there's also an "snprintf"). When I finish the GNU C library it will be freely distributed and you can then use it. In general, one should take care when using the sprintf functions. Make sure you know the maximum length that the format specification will produce and arrange to have at least that much space allocated. -- Roland McGrath ARPA: roland@rtsg.lbl.gov roland@lbl-rtsg.arpa UUCP: ...!ucbvax!lbl-rtsg.arpa!roland