Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

libhpfeeds/src/hpfeeds.c hdr.msglen update bug

  • Loading branch information...
commit 305f46b5dba6dd9dc4f9a5b2ef786ded6b83c1f0 1 parent df9311a
@bg6cq bg6cq authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 libhpfeeds/src/hpfeeds.c
View
4 libhpfeeds/src/hpfeeds.c
@@ -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;
}
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.