diff options
Diffstat (limited to 'kris/util.c')
| -rw-r--r-- | kris/util.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 <netinet/in.h> #include <sys/socket.h> +#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'; } |
