fix incomplete buffer initialization

This commit is contained in:
nion@noname 2006-01-29 20:50:20 +01:00
parent c1ea031434
commit da96e34948

4
ii.c
View File

@ -228,7 +228,6 @@ static void proc_channels_input(Channel *c, char *buf)
{ {
static char infile[256]; static char infile[256];
char *p; char *p;
if(buf[0] != '/' && buf[0] != 0) { if(buf[0] != '/' && buf[0] != 0) {
proc_channels_privmsg(c->name, buf); proc_channels_privmsg(c->name, buf);
return; return;
@ -262,7 +261,7 @@ static void proc_channels_input(Channel *c, char *buf)
return; return;
break; break;
case 'n': 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]); snprintf(message, PIPE_BUF, "NICK %s\r\n", &buf[3]);
break; break;
case 'l': 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 void handle_channels_input(Channel *c)
{ {
static char buf[PIPE_BUF]; static char buf[PIPE_BUF];
memset(buf,0,sizeof(buf));
if(read_line(c->fd, PIPE_BUF, buf) == -1) { if(read_line(c->fd, PIPE_BUF, buf) == -1) {
int fd = open_channel(c->name); int fd = open_channel(c->name);
if(fd != -1) if(fd != -1)