Skip to content

Commit

Permalink
libhpfeeds/src/hpfeeds.c hdr.msglen update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bg6cq committed Jun 22, 2012
1 parent df9311a commit 305f46b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libhpfeeds/src/hpfeeds.c
Expand Up @@ -68,7 +68,7 @@ hpf_msg_t *hpf_msg_add_chunk(hpf_msg_t **m, const u_char *data, size_t len) {
((u_char *) msg)[ntohl(msg->hdr.msglen)] = l;
memcpy(((u_char *) msg) + ntohl(msg->hdr.msglen) + 1, data, l);

msg->hdr.msglen += htonl(1 + l);
msg->hdr.msglen = htonl(ntohl(msg->hdr.msglen) + 1 + l);

return msg;
}
Expand Down Expand Up @@ -99,7 +99,7 @@ hpf_msg_t *hpf_msg_add_payload(hpf_msg_t **m, const u_char *data, size_t len) {

memcpy(((u_char *) msg) + ntohl(msg->hdr.msglen), data, len);

msg->hdr.msglen += htonl(len);
msg->hdr.msglen = htonl(ntohl(msg->hdr.msglen) + len);

return msg;
}
Expand Down

0 comments on commit 305f46b

Please sign in to comment.