[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hobbitfetch core dump fix



I was having issues with hobbitfetch core dumping.
I finally figured out the issue.

In the "grabdata" function there is:
int n;
char buf[8192];

/* Read data from a peer connection (client or server) */
n = read(conn->sockfd, buf, sizeof(buf));
...
else if (n > 0) {
...
buf[n] = '\0';
...

If 8192 bytes are read then "n" is 8192.  There is no element 8192 in
buf.  buf is 0-8191.