ii

git clone https://orangeshoelaces.net/git/ii.git

da96e34948197fd3cc6d299397278c7acb1279fe

Author: nion@noname on 01/29/2006

Committer: nion@noname on 01/29/2006

fix incomplete buffer initialization

Stats

ii.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/ii.c b/ii.c
index 67e260f..5cac11a 100644
--- a/ii.c
+++ b/ii.c
@@ -228,7 +228,6 @@ static void proc_channels_input(Channel *c, char *buf)
 {
 	static char infile[256];
 	char *p;
-
 	if(buf[0] != '/' && buf[0] != 0) {
 		proc_channels_privmsg(c->name, buf);
 		return;
@@ -262,7 +261,7 @@ static void proc_channels_input(Channel *c, char *buf)
 		return;
 		break;
 	case 'n':
-		snprintf(nick, sizeof(nick),"%s", buf);
+		snprintf(nick, sizeof(nick),"%s", &buf[3]);
 		snprintf(message, PIPE_BUF, "NICK %s\r\n", &buf[3]);
 		break;
 	case 'l':
@@ -389,6 +388,7 @@ static int read_line(int fd, size_t res_len, char *buf)
 static void handle_channels_input(Channel *c)
 {
 	static char buf[PIPE_BUF];
+	memset(buf,0,sizeof(buf));
 	if(read_line(c->fd, PIPE_BUF, buf) == -1) {
 		int fd = open_channel(c->name);
 		if(fd != -1)