From 2b853804113a01672790aed67cb372d35554b61e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 23 Sep 2009 11:26:48 -0400 Subject: [PATCH] Update kris/util.c strlcpy --- kris/Makefile | 1 + kris/config.mk | 1 + kris/sic.c | 10 +--------- kris/util.c | 9 ++++++++- 4 files changed, 11 insertions(+), 10 deletions(-) create mode 120000 kris/Makefile create mode 120000 kris/config.mk diff --git a/kris/Makefile b/kris/Makefile new file mode 120000 index 0000000..d0b0e8e --- /dev/null +++ b/kris/Makefile @@ -0,0 +1 @@ +../Makefile \ No newline at end of file diff --git a/kris/config.mk b/kris/config.mk new file mode 120000 index 0000000..f2cf390 --- /dev/null +++ b/kris/config.mk @@ -0,0 +1 @@ +../config.mk \ No newline at end of file diff --git a/kris/sic.c b/kris/sic.c index 4767aa7..dd120ea 100644 --- a/kris/sic.c +++ b/kris/sic.c @@ -28,14 +28,6 @@ static char channel[256]; static time_t trespond; static FILE *srv; -#define va_buf(buf, fmt) {\ - va_list ap; \ - \ - va_start(ap, fmt); \ - vsnprintf(buf, sizeof buf, fmt, ap); \ - va_end(ap); \ -} - #include "util.c" static void @@ -167,7 +159,7 @@ main(int argc, char *argv[]) { if(++i < argc) password = argv[i]; break; case 'v': - eprint("sic-"VERSION", ? 2005-2007 Anselm R. Garbe, Nico Golde\n"); + eprint("sic-"VERSION", ©2005-2009 Kris Maglione, Anselm R. Garbe, Nico Golde\n"); default: eprint("usage: sic [-h host] [-p port] [-n nick] [-k keyword] [-v]\n"); } diff --git a/kris/util.c b/kris/util.c index 19c2f2b..53b2fe8 100644 --- a/kris/util.c +++ b/kris/util.c @@ -2,6 +2,13 @@ #include #include +#define va_buf(buf, fmt) {\ + va_list ap; \ + va_start(ap, fmt); \ + vsnprintf(buf, sizeof buf, fmt, ap); \ + va_end(ap); \ +} + static void eprint(const char *fmt, ...) { @@ -34,7 +41,7 @@ dial(char *host, int port) { #define strlcpy _strlcpy static void strlcpy(char *to, const char *from, int l) { - strncpy(to, from, l-1); + memccpy(to, from, '\0', l); to[l-1] = '\0'; }