[hackers] [sic] Update kris/util.c strlcpy || Kris Maglione

From: <hg_AT_suckless.org>
Date: Wed, 23 Sep 2009 15:27:18 +0000 (UTC)

changeset: 101:0cfd0578723c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Wed Sep 23 11:26:48 2009 -0400
files: kris/Makefile kris/config.mk kris/sic.c kris/util.c
description:
Update kris/util.c strlcpy

diff -r fe7d70b90d11 -r 0cfd0578723c kris/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kris/Makefile Wed Sep 23 11:26:48 2009 -0400
@@ -0,0 +1,1 @@
+../Makefile
\ No newline at end of file
diff -r fe7d70b90d11 -r 0cfd0578723c kris/config.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kris/config.mk Wed Sep 23 11:26:48 2009 -0400
@@ -0,0 +1,1 @@
+../config.mk
\ No newline at end of file
diff -r fe7d70b90d11 -r 0cfd0578723c kris/sic.c
--- a/kris/sic.c Wed Sep 23 14:32:20 2009 +0100
+++ b/kris/sic.c Wed Sep 23 11:26:48 2009 -0400
@@ -28,14 +28,6 @@
 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 @@
                         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 -r fe7d70b90d11 -r 0cfd0578723c kris/util.c
--- a/kris/util.c Wed Sep 23 14:32:20 2009 +0100
+++ b/kris/util.c Wed Sep 23 11:26:48 2009 -0400
@@ -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 @@
 #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';
 }
 
Received on Wed Sep 23 2009 - 15:27:18 UTC

This archive was generated by hypermail 2.2.0 : Wed Sep 23 2009 - 15:36:07 UTC