From: Matthias A. <ma...@dt...> - 2004-11-10 21:14:40
|
Graham Wilson <gr...@mk...> writes: > On Wed, Nov 10, 2004 at 01:04:34PM -0600, sv...@de... wrote: >> Added: >> trunk/trio/ >> Log: >> Import Trio 1.10 into fetchmail's trunk. > > What is this and why do we need it? This is the best GPL-compatible snprintf/sscanf replacement (including varargs variants) that I've been able to find as a separate project. The idea is to get rid of insecure and ugly coding practices such as using [v]sprintf or strcat on older systems that lack [v]snprintf, and the way we'd seen this integrated in the code was messy: #ifdef HAVE_SNPRINTF snprintf(buf, sizeof buf, /* safer */ #else sprintf(buf, /* unsafe */ #endif rest, of, arguments); The diffstat looks like this: Makefile.am | 18 ++++++++++++-- configure.ac | 52 ++++++++++++++++++++++++++++++++++++++++ cram.c | 4 --- driver.c | 30 +++-------------------- fetchmail.h | 5 +++ imap.c | 6 ---- interface.c | 7 ----- ipv6-connect.c | 23 +++-------------- report.c | 46 ----------------------------------- sink.c | 59 +++++----------------------------------------- smtp.c | 34 ++++---------------------- socket.c | 15 ----------- transact.c | 73 ++++----------------------------------------------------- 13 files changed, 103 insertions(+), 269 deletions(-) Not counting the first two files, we are now down by over 200 lines of half-baked C code. I'm not fixed on Trio, if you know something better, we can flush Trio and use something else, but I'm not willing to allow the ugly old structure back in. -- Matthias Andree |