Ver código fonte

The generic reader didn't have a buffer that was large enough to

save uncomplete messages. I had forgotten about the four bytes of
message length preceding the message. A buffer overflow could occur
because of this. Ouch!
master
Richard Nyberg 19 anos atrás
pai
commit
f8a4999e40
2 arquivos alterados com 2 adições e 1 exclusões
  1. +1
    -0
      btpd/net.c
  2. +1
    -1
      btpd/net.h

+ 1
- 0
btpd/net.c Ver arquivo

@@ -766,6 +766,7 @@ net_generic_read(struct peer *p, unsigned long rmax)
}
if (off != len) {
gr->iob.buf_off = len - off;
assert(gr->iob.buf_off <= gr->iob.buf_len);
bcopy(buf + off, gr->iob.buf, gr->iob.buf_off);
}
event_add(&p->in_ev, NULL);


+ 1
- 1
btpd/net.h Ver arquivo

@@ -65,7 +65,7 @@ struct handshake {
char _io_buf[SHAKE_LEN];
};

#define MAX_INPUT_LEFT 12
#define MAX_INPUT_LEFT 16

struct generic_reader {
struct input_reader rd;


Carregando…
Cancelar
Salvar